Git Terms
Git Terms
Common terms
Branch
• A branch is a version of the repository that diverges from the main
working project.
• It is an essential feature available in most modern version control
systems.
• A Git project can have more than one branch. We can perform many
operations on Git branch-like rename, list, delete,etc.
Checkout
• In Git, the term checkout is used for the act of switching between
different versions of a target entity.
• The git checkout command is used to switch between branches in a
repository
Cherry-Picking
• Cherry-picking in Git is meant to apply some commit from one branch
into another branch.
• In case you made a mistake and committed a change into the wrong
branch, but do not want to merge the whole branch. You can revert
the commit and cherry-pick it on another branch.
Clone
• The git clone is a Git command-line utility. It is used to make a copy of
the target repository or clone it.
• If I want a local copy of my repository from GitHub, this tool allows
creating a local copy of that repository on your local directory from
the repository URL.
Fetch
• It is used to fetch branches and tags from one or more other
repositories, along with the objects necessary to complete their
histories. It updates the remote-tracking branches.
HEAD
• HEAD is the representation of the last commit in the current checkout
branch. We can think of the head like a current branch.
• When you switch branches with git checkout, the HEAD revision
changes, and points the new branch.
Index
• The Git index is a staging area between the working directory and
repository. It is used as the index to build up a set of changes that you
want to commit together.
Master
• Master is a naming convention for Git branch. It's a default branch of
Git.
• After cloning a project from a remote server, the resulting local
repository contains only a single local branch.
• This branch is called a "master" branch. It means that "master" is a
repository's "default" branch.
Merge
• Merging is a process to put a forked history back together. The git
merge command facilitates you to take the data created by git branch
and integrate them into a single branch.
Origin
• In Git, "origin" is a reference to the remote repository from a project
was initially cloned.
• More precisely, it is used instead of that original repository URL to
make referencing much easier.
Pull/Pull Request
• The term Pull is used to receive data from GitHub. It fetches and
merges changes on the remote server to your working directory. The
git pull command is used to make a Git pull.
• Pull requests are a process for a developer to notify team members
that they have completed a feature.
• Once their feature branch is ready, the developer files a pull request
via their remote server account. Pull request announces all the team
members that they need to review the code and merge it into the
master branch.
Push
• The push term refers to upload local repository content to a remote
repository.
• Pushing is an act of transfer commits from your local repository to a
remote repository. Pushing is capable of overwriting changes; caution
should be taken when pushing.
Rebase
• In Git, the term rebase is referred to as the process of moving or
combining a sequence of commits to a new base commit.
• Rebasing is very beneficial and visualized the process in the
environment of a feature branching workflow.
• From a content perception, rebasing is a technique of changing the
base of your branch from one commit to another.
Remote
• In Git, the term remote is concerned with the remote repository. It is
a shared repository that all team members use to exchange their
changes.
• A remote repository is stored on a code hosting service like an
internal server, GitHub, Subversion and more.
• In case of a local repository, a remote typically does not provide a file
tree of the project's current state, as an alternative it only consists of
the .git versioning data.
Repository
• In Git, Repository is like a data structure used by VCS to store
metadata for a set of files and directories.
• It contains the collection of the file as well as the history of changes
made to those files.
• Repositories in Git is considered as your project folder. A repository
has all the project-related data. Distinct projects have distinct
repositories.
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 branch without
committing the current branch.
Tag
• A tag allows you to label your commits (and other Git objects) by
assigning them readable names that can be easily referenced when
traversing the history of a Git repository.
Upstream And Downstream
• The term upstream and downstream is a reference of the repository.
Generally, upstream is where you cloned the repository from (the
origin) and downstream is any project that integrates your work with
other works. However, these terms are not restricted to Git
repositories.
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.
Git Reset
• In Git, the term reset stands for undoing changes. The git reset
command is used to reset the changes.
Git Ignore
• In Git, the term ignore used to specify intentionally untracked files
that Git should ignore. It doesn't affect the Files that already tracked
by Git.
Git Diff
• Git diff is a command-line utility. It's a multiuse Git command. When
it is executed, it runs a diff function on Git data sources.
• These data sources can be files, branches, commits, and more. It is
used to show changes between commits, commit, and working tree,
etc.
Git Cheat Sheet
• A Git cheat sheet is a summary of Git quick references. It contains
basic Git commands with quick installation.
• A cheat sheet or crib sheet is a brief set of notes used for quick
reference. Cheat sheets are so named because the people may use it
without no prior knowledge.
Git Flow
• GitFlow is a branching model for Git, developed by Vincent Driessen.
It is very well organized to collaborate and scale the development
team. Git flow is a collection of Git commands. It accomplishes many
repository operations with just single commands.
Git 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.
Git Rm
• In Git, the term rm stands for remove. It is used to remove individual
files or a collection of files.
• The key function of git rm is to remove tracked files from the Git
index. Additionally, it can be used to remove files from both the
working directory and staging index.
Git Fork
• A fork is a rough copy of a repository. Forking a repository allows you
to freely test and debug with changes without affecting the original
project.
• Great use of using forks to propose changes for bug fixes. To resolve
an issue for a bug that you found, you can:
• Fork the repository.
• Make the fix.
• Forward a pull request to the project owner.