git [Docs]

User Tools

Site Tools



Git is a Distributed Version Control system that can track changes It does not rely on a central server to store all the versions

git config Git uses your username to associate commits with an identity. The git config command can be used to change your Git configuration, including your username.

What does commit object contains? Commit object contains the following components, you should mention all the three points present below:

  • A set of files, representing the state of a project at a given point of time
  • Reference to parent commit objects
  • An SHAI name, a 40 character string that uniquely identifies the commit object.


squash last N commits into a single commit

git rebase -i HEAD~3

git-bisect - Use binary search to find the commit that introduced a bug

git flow

Master - is always ready to be released on LIVE, with everything fully tested and approved (production-ready). Hotfix - Maintenance or “hotfix” branches are used to quickly patch production releases. Develop - is the branch to which all feature branches are merged and where all tests are performed. Feature - Each new feature should reside in its own branch, which can be pushed to the develop branch as their parent one.

git rebase Reverting (as in undoing) a rebase is considerably difficult and/or impossible (if the rebase had conflicts) compared to reverting a merge

A repository contains a directory named .git, where git keeps all of its metadata for the repository. The content of the .git directory are private to git.

What is “Staging Area” or “Index” in GIT?

Before completing the commits, it can be formatted and reviewed in an intermediate area known as ‘Staging Area’ or ‘Index’.

‘Git Status’ shows you the difference between the working directory and the index

The function of ‘Git Reset’ is to reset your index as well as the working directory to the state of your last commit.

A fork is a remote, server-side copy of a repository, distinct from the original. A fork isn't a Git concept really, it's more a political/social idea. A clone is not a fork; a clone is a local copy of some remote repository. When you clone, you are actually copying the entire source repository, including all the history and branches.

A branch is just a separate version of the code.

A pull request is when someone take the repository, makes their own branch, does some changes, then tries to merge that branch in (put their changes in the other person's code repository).

The working tree/working directory/workspace is the directory tree of (source) files that you see and edit. The index/staging area is a single, large, binary file in <baseOfRepo>/.git/index, which lists all files in the current branch, their sha1 checksums, time stamps and the file name - it is not another directory with a copy of files in it.

git bisect

git.txt · Last modified: 2020/07/02 16:06 (external edit)