Cheat Sheet For Git

Cheat Sheet For Git

What is Git?

Git is a version control system used for tracking changes in computer files. It is generally used for source code management in software development.

  • Git is used to tracking changes in the source code.
  • The distributed version control tool is used for source code management.
  • It allows multiple developers to work together.

Difference betweeen Git and GitHub

Git is a version control system, a tool to manage your source code history.

GitHub is a hosting service for Git repositories.

So they are not the same thing: Git is the tool, GitHub is the service for projects that use Git.


Common Git commands used in various situations:

  • git init : Create empty Git repo in specified directory

  • git config --global user.name [Name] : Tell Git who you are by configuring the author name

  • git config --global user.email [] : Tell Git who you are by configuring the author email id.

  • git status : List which files are staged, unstaged, and untracked

  • git commit -m "[message]" : Commit the staged files with use of [message] as the commit message.

  • git log : Display the entire commit history using the default format

  • git pull [remote] : Fetch the remote’s copy of current branch into the local copy.

  • git push [remote] --all : Push all of your local branches to the specified remote.

  • git fetch [remote] [branch] --all : Fetches a specific [branch], from the repo. Leave off [branch] to fetch all remote refs.

  • git clone : Make a local copy of the server repository.

  • git revert : Undo the changes.

  • git cherry-pick : Choosing a commit from one branch and applying it to another is known as cherry picking in Git.


That's all from my side. Thanks a lot for reading my article.