All about git terminology

What is called what?

Amandeep Singh
9 min readOct 18, 2023
Photo by Roman Synkevych on Unsplash
  1. Repository: A git repository is a folder or directory that contains all the files and the complete history of changes for a project. There can be a local repository (on your computer) and a remote repository (hosted on platforms like GitHub or GitLab.
  2. Clone: To create a copy of a remote repository on your local machine. you “clone” it. This gives you a local version of the project to work on.
  3. Branch: A branch is a separate line of development in a git repository. You can create branches to work on new features or bug fixes without affecting the main branch.
  4. Commit: A commit is a snapshot of the changes made to the files in a repository at a specific point in time. Each commit has a unique identifier (SHA-1 hash) and includes a commit message for the changes.
  5. Checkout: To switch between different branches or commits you check out a specific branch or commit. This updates your working directory to reflect the chosen state of the project
  6. Pull: To update your local repository with changes from a remote repo, you pull those changes. this is typically done before pushing your own changes to ensure you have the latest update.
  7. Push: When you want to upload your local changes to the remote repository, you push them.
  8. Merge: Merging combines changes from one branch into another. This integrates the changes into the target branch
  9. Pull Request: In the context of a platform like GitHub, a pull request is a way to propose changes to a repository. It allows collaborators to review and discuss the proposed changes before merging them into the main branch.
  10. Fork: Foeking creates a copy of a repository on a remote platform such as GitHub. This copy is independent of the original and you can make changes to it without affecting the original project
  11. Conflict: When git can’t automatically merge changes because the conflict with each other, a conflict occurs.
  12. Staging: Before committing changes you stage them using the “git add” command. Staging allows you to select which changes should be included in the next commit.
  13. gitignore: A file named “gitignore” specifies which files and directories should be excluded from version control.
  14. Remote: A remote is a reference to a repository hosted in a different location. typically on a remote server or a platform like GitHub.
  15. Upstream: Think of upstream as the changes that you have made and now you want to send (Upstream) those changes to get merged into the project.
  16. Downstream: When you download or clone a repository and information is flowed (Downstream) from the repository to you means the Downstream in general.
  17. HEAD: HEAD is a special pointer in git that points to the currently checked-out branch or commit. It represents your working directory’s current state.
  18. Tag: A tag is a named reference to a specific commit. Tags are often used to mark significant points in a project's history such as releases or milestones.
  19. Rebase: Rebasing is a git operation that allows you to move or combine a sequence of commits onto a new base commit. It can help create a linear history.
  20. Cherry-Pick: Cherry-picking is the process of selecting and applying specific commit from one branch to another. It’s useful for applying individual changes without merging entire branches.
  21. SubModule: A submodule is a git repository embedded within another git repository. It allows you to include another project as a dependency within your own project.
  22. Diff: to show differences between two sets of code in git.
  23. Gist: on Github a gist is a simple way to share code snippets
  24. Blame: Git blame or annotate functionality shows who last modified each line of code in a file and when. It’s useful for tracking changes and finding the author for specific code.
  25. RefLog: the reflog shorts for reference log is a log that records updates to the tips of branches and other references in the git repository. It can help you recover the last commits or branches.
  26. Git Hook: Git hooks are scripts that git can execute at specific points in its lifecycle, such as before or after commit merges or pushes. They allow you to automate tasks or enforce work flow policies.
  27. Fast-Forward: A fast-forward merge is a type of merge where git can automatically integrate changes from one branch into another without creating a merge commit. This occurs when the branch is merged into another branch that has not diverged.
  28. Detach HEAD: A detached HEAD state occurs when you check out a specific commit rather than a branch. In this state, any new commits won’t be part of a branch until you create one.
  29. Stashing: Sometimes you want to switch the branches, but you are working on an incomplete part of your current project. You don’t want to make a commit of half-done work. Git stashing allows you to do so. The git stash command enables you to switch branches without committing the current branch.
  30. Squash: In Git, the term squash is used to squash previous commits into one. Git squash is an excellent technique to group-specific changes before forwarding them to others. You can merge several commits into a single commit with the powerful interactive rebase command.
  31. Git Revert: In Git, the term revert is used to revert some commit. To revert a commit, git revert command is used. It is an undo type command. However, it is not a traditional undo alternative.
  32. Git Reset: In Git, the term reset stands for undoing changes. The git reset command is used to reset the changes. The git reset command has three core forms of invocation. These forms are as follows.
  33. Bare Repository: A bare repository is normally an appropriately named directory with a .git suffix that does not have a locally checked-out copy of any of the files under revision control.
  34. Bisect: Git bisect is a tool for finding the commit that introduced a bug or issue. It uses a binary search algo to narrow down the range of possible problematic commits
  35. Patch: A patch is a file containing changes made to git repository. It can be shared and applied to other repositories to replicate those changes
  36. Refspec: A refspec is a configuration setting in git that defines how references are mapped between local and remote repository during fetch and push operations.
  37. Blamestorming: this refers to the practice of trying to identify who is responsible for a problem or bug by using git’s blame feature.
  38. Git LFS (Large File Storage): This is an extension to git that deals with large files more efficiently by storing them outside the git repository and managing them separately.
  39. GPG (GNU Privacy Guard): Git can use GPG for signing commits and tags to provide a cryptographic verification of the authority and integrity of your code.
  40. Rebase Interactive: This allows you to interactively modify commit history during a rebase operation. You can edit, squash, or reorder commit to create a cleaner history.
  41. Shallow Clone: A shallow clone is a git repository that only contains a limited portion of the commit history, stopping at a specific depth. This can be useful for reducing the size of a clone.
  42. Force Push: A force push is a git command that overwrites the remote branch’s history with the local branch’s history. It should be used with caution and only when necessary, to avoid data loss.
  43. Index: The git index (also known as a staging area) is a temporary area where changes are prepared to be committed. you use the “git add” command to move changes from your working directory to the index.
  44. Work in Progress (WIP) Commit: A WIP commit is a commit with a message like WIP to save your ongoing work temporarily without providing a detailed commit message.
  45. Git Commit Ammend: This option in Git allows you to add changes to the most recent commit without creating a new commit effectively modifying the commit history.
  46. Origin: The conventional name for the primary version of a repository. Git also uses origin as a system alias for pushing and fetching data to and from the primary branch. For example, git push origin master, when run on a remote, will push the changes to the master branch of the primary repository database.
  47. 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, or untracked files. It shows the working tree status of the current repository.
  48. Git Cheat Sheet: The Git cheat sheet will result in a 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. https://about.gitlab.com/images/press/git-cheat-sheet.pdf
  49. GitFlow: It’s an alternative to 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.
  50. Git rm: The 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.

Useful Commands

Certainly, here are Git commands for each of the points

Clone:

To create a local copy of a remote repository

git clone <repository_url>

Branch:

To create a new branch

git branch <branch_name>

Commit:

To create a commit with changes and a commit message

git commit -m "Your commit message"

Checkout

To switch to a different branch or commit

git checkout <branch_or_commit_name>

Pull:

To update your local repository with changes from a remote repository

git pull

Push:

To upload your local changes to the remote repository

git push

Merge:

To merge changes from one branch into another

git merge <source_branch>

Pull Request:

Creating a pull request is typically done through a platform like GitHub. There is no direct Git command for this.

Fork:

To fork a repository on GitHub or a similar platform, you can use the web interface. There’s no direct Git command for forking.

Conflict:

Resolving conflicts is done through a merge or rebase operation, not a single Git command.

Staging:

To stage changes before committing

git add <file_name>

gitignore:

Create a `.gitignore` file and list files and directories to exclude from version control within it.

Remote:

To view a list of remote repositories

git remote -v

Upstream:

Upstream typically refers to a remote repository, so it’s part of the `git push` and `git pull` commands.

Downstream:

Downstream is not a specific Git command but refers to the flow of information from a repository to you when you clone it.

HEAD:

HEAD is a reference to the currently checked-out commit. It’s not manipulated directly with a command.

Tag:

To create a tag for a specific commit

git tag <tag_name> <commit_hash>

Rebase:

To perform an interactive rebase

git rebase -i <base_commit>

Cherry-Pick:

To apply a specific commit from one branch to another

git cherry-pick <commit_hash>

SubModule:

To work with submodules, you’ll need to use a combination of commands like `git submodule init`, `git submodule update`, and others.

Diff:

To show the differences between two sets of code

git diff <commit1> <commit2>

Gist:

Creating a Gist is done through the web interface on GitHub.

Blame:

To show who last modified each line of code in a file

git blame <file_name>

RefLog:

To view the reflog

git reflog

Git Hook:

Git hooks are scripts placed in the `.git/hooks` directory and are executed at specific Git lifecycle events.

Fast-Forward:

Fast-forward merges happen automatically when you merge a branch that hasn’t diverged from the target branch.

Stashing:

To stash changes and switch branches

git stash

Squash:

Squashing commits is part of an interactive rebase. You can squash commits by specifying “squash” during an interactive rebase.

Git Revert:

To revert a specific commit

git revert <commit_hash>

Git Reset:

To reset changes (use with caution)

git reset <options>

Bare Repository:

A bare repository is typically created when you initialize a new repository with ` — bare` flag

git init - bare

Bisect:

To start a bisect session:

git bisect start

Patch:

To create a patch

git format-patch -1 <commit_hash>

Refspec:

Refspec configuration is typically done in Git’s configuration files, not through a specific command.

Blamestorming:

Blamestorming is a concept rather than a specific Git command.

Git LFS (Large File Storage):

To use Git LFS, you need to install it and configure it. There are no specific Git commands for this.

GPG (GNU Privacy Guard):

To use GPG for signing commits, you need to configure it in your Git settings. No specific command is required.

Rebase Interactive

git rebase -i

Shallow Clone:

To perform a shallow clone with a limited commit history:

git clone - depth 1 <repository_url>

Force Push:

git push - force

Index:

The index is part of Git’s normal workflow, and you interact with it by using `git add` and other commands.

Work in Progress (WIP) Commit:

You can create a WIP commit with a message like “WIP” using `git commit`.

Git Commit Amend:

To amend the most recent commit

git commit - amend

Origin:

Origin is often the default remote name in Git. You’ll use it in commands like

git push origin

Status:

To check the status of your local repository

git status

GitFlow:

GitFlow is a branching strategy, not a specific Git command. You’d follow the GitFlow workflow using regular Git commands.

Git rm:

To remove a file from both the index and the working tree

git rm <file_name>

--

--

Amandeep Singh

👓 Software Engineer | 📚 Lifelong Learner | 🧩 Problem Solver | 🔧 Process Engineer | 🏗️ App Architect | ☕ Java Junkie