Open In App

30 Most Important Git Terminologies That Developers Must Know

Improve
Improve
Like Article
Like
Save
Share
Report

Git is a version control system for tracking changes in computer files and coordinating work on those files among multiple people. Git is designed for teams. It was originally designed for distributed work but has evolved to be used in a wide variety of contexts. Git is free and open-source software. Git has been used by many companies, including Google, GitHub, and Mozilla. Git is used by many other open-source projects. It was originally developed by Linus Torvalds but has since been adopted by many other developers.

30-Most-Important-Git-Terminologies

The first version of Git was released in 2005. Now to know the basics of Git, we will use the command-line interface (CLI) of Git. The CLI is a command-line interface for Git. It is used to perform the following tasks: add, commit, push, pull, and more. In this article, we are going to understand the basic terminology of Git.

1. Git Repository

A Git repository is a directory that contains a Git working directory. The working directory contains all the files that are tracked by Git. The Git repository is the place where the files are stored. We can think of a Git repository as a file system. Where the files are stored. Git Repository has a directory structure. The directory structure is similar to the directory structure of a file system.

2. Git Working Directory

A Git working directory is a directory that contains all the files that are tracked by Git. Tracked by Git means that Git tracks the files in the working directory that will be committed.

3. Git Remote Repository

A Git remote repository is a repository that is stored on a remote server. We can think of a Git remote repository as a remote file system. Where the files are stored. Git Remote Repository has a directory structure. A Git remote repository is useful when we want to share the files with other developers. We can use Git Remote Repository to share the files with other developers. A Git Repository can be local or remote. Don’t confuse yourself with the terminology. Both the Git Repository and Git Remote Repository are directories.

4. Branch

As its name suggests, the branch can be thought of as an alternate repository that diverges from the Git Working Directory or main project. We can think of a Branch as an extra repository that is used to work on adding specific features to the project. A Branch can be a different version of the same repository. It can be stable, beta, or alpha. In Git we can apply CRED operation i.e we can create a branch, commit, and then push the branch to the remote repository. We can list all the files from the branch and then pull the branch from the remote repository. We can do changes to that branch and then push the changes to the remote repository. Also, we can delete the branch if we want to. Most importantly, we can merge the branch to the main project.

5. Checkout

Checkout is a command that is used to switch between branches. We can check out a branch to the main project or a beta version of that project. In a project consider the 3 different branches namely the main project branch or stable branch, beta branch, and alpha branch. We can switch to the beta branch using the command git checkout beta and then using the command git check out main we can switch from the beta branch to the main project branch.

6. Merge

Merge is a command that is used to merge the changes from one branch to another branch. We can merge the changes from the beta branch to the main project branch using the command git merge beta.

7. Pull

Pull is a command that is used to pull the changes from the remote repository to the local repository. We can pull the changes from the remote repository to the local repository using the command git pull. Git Pull will fetch the changes from the remote repository and then download that content locally from the remote repository.

8. Push

Push is a command that is used to push the changes from the local repository to the remote repository. We can push the changes from the local repository to the remote repository using the command git push. A git push command has two arguments one is the repository and the other is the branch name to which you are going to push the changes.

9. Status

Status is a command that is used to show the status of the local repository. We can show the status of the local repository using the command git status. A status can be staging area, unstaged changes, staged changes, untracked files. It shows the working tree status of the current repository.

10. Clone

Clone is a command that is used to clone the remote repository to the local repository. By clone, we mean that we can able to copy the whole repository locally. We can clone the remote repository to the local repository using the command git clone repo. Here is the repo, which is the repository address that we want to clone.

11. Cherry-pick

Cherry-pick is a command that is used to cherry-pick the changes from one branch to another branch. We can cherry-pick the changes from the beta branch to the main project branch using the command git cherry-pick beta. Think of it as copying the older changes from one branch to another branch.

12. Fetch

Fetch is a command that is used to fetch the changes from the remote repository to the local repository. The Git fetch command not only downloads the changed file but also the commits. Using the command git fetch –all we can fetch all the branches from a certain repository.

13. Fork

A git fork is a copy of a repository that is stored on a remote server. After forking a repository we can test the repository and then push the changes to that forked repository. WE usually fork the repository to test and fix the bugs from the repository. Once we have fixed the bug then we can create a pull request to the original repository from where we have forked the repository.

14. HEAD

The HEAD in Git is a symbolic reference to a commit. It is used to refer to the current commit. HEAD is the default branch. Whenever we do any change or switch to a branch, the HEAD is updated to point to the new branch.

15. Index

A Git Index is different from the HEAD, in git index the new commit is prepared and eventually goes into the HEAD. It is a staging area. When we add files to the staging area, the files are added to the index. When we commit, the files are added to the HEAD.

16. Master/Main

We usually call the main branch as master. It is the default branch. It is the main branch of the repository. It is the branch that is used to develop the project. It is the primary branch in the repository.

17. Origin

Origin is basically an alternative local alias that is set in place of the remote repository URL. It refers to the remote URL of the repository.

18. Pull or Pull Request

A pull request is a request to merge a branch into another branch. It is used to merge a branch into the main project branch. We use the git pull command to ask the repository maintainer to review the changes and merge them to the project is acceptable.

19. Rebase

Rebase or we can say rewriting history, Its a powerful feature of Git, using this we can move commits to a new base commit. We do Rebase to main the project structure. Suppose we found a bug that was previously not there, and after so many changes now a particular feature is broken in that case we can rebase the project to the last stable version.

20. Stash

Stash command can be helpful when we don’t want to commit the changes in the working branch. But we want to switch the branch and after finishing with the branch we want to come back and commit those leaved changes. In this kind of scenario the git stash commands help, it saved our uncommitted changes for later use.

21. Tag

Git-Tags are a kind of reference pointer that points in the Git history. Tags can be of two types lightweight and Annotated. A lightweight tag is a tag that points to a commit. An annotated tag is a tag that points to a commit and also contains a message.

22. Upstream And Downstream

In Git terms, think of Upstream as the changes that you have made and now you want to send(Upstream) those changed to get merged into the project. And When you download or clone a repository and information is flowed (Downstream) from the repository to you means the Downstream in general.

23. Git revert

Git Revert is a command that is used to revert the commits. We can revert the commits using the command git revert. Think of it as an undo command in Git.

24. Git reset

Git Reset command will reset the changes in the working tree. It will reset the changes in the index and the working tree. It will also reset the HEAD to the previous commit. Depending upon which forms we used for the git reset command, it will reset the git repository. following are the forms of the git reset command.

24.a. Soft

When the soft argument is used only the reference pointer is reset.

git reset –soft HEAD 

24.b. Mixed

In this reference, pointers are updated and the staging index is reset to the specified commit.

git reset –mixed HEAD

24.c. Hard

This will reset the staging index, working everything to match the specified commit, and most of the time it will be used in the case of a merge conflict.

git reset –hard HEAD

25. Git Ignore

Git ignore command will ignore the files that we don’t want to commit. This command will not add the files to the staging area. And it will not affect the already tracked files.

26. Git Diff

Git diff command will show the difference between the working tree and the index. It will show the difference between the index and the HEAD. Git diff will show the changes that are staged for commit.

27. Git Cheat Sheet

The Git cheat sheet command will result in the summary of all the git commands. It is a brief description of all the git commands. It is so-called a cheat sheet because it can give you a quick overview of all the git commands.

28. GitFlow

It’s an alternative for the git branching model. Using GitFlow we can have multiple versions in production at a time. It is usually used by the organization for releasing their projects. It was proposed and populated by Vincent Driessen. I

29. Git Squash

Git squash command will squash the commits. It will squash the commits and then add the squashed commits to the index. It will pick the previous commit and the new commit then squash the changes. That means it will group the changes before merging them. If we have multiple commits then it will squash them into one commit.

30. Git rm

Git rm command will remove the files from the index. It will remove the files from the index and the working tree. It will also remove the files from the git repository. It is a powerful command that can be used to remove files from the repository.



Last Updated : 14 Feb, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads