Hey everyone, In this article, we will see the most used Git Bash commands and give a quick start with a cheat sheet. We already discussed in the brief of Git commands earlier Important Basic Git Commands – Developers should know.

Git helps to track and work on the same workspace that developers or organizations use to collaborate on developing applications.

So, let’s start with the Git commands.


Set the name and email that will be attached to your commits and tags

Start a Project

Create a local repo (omit <directory> to initialize the current directory as a git repo)

Make a Change

Add a file to the staging

Basic Concepts

main or master: default development branch

origin: default upstream repo

HEAD: current branch

HEAD^: parent of HEAD

HEAD~2: grandparent of HEAD


  • List all local branches.
  • Add -r flag to show all remote branches.
  • Use -a flag for all branches.
  • If you want to switch to a branch & update the working directory.
  • Delete a branch
  • Add a tag to the current commit (often used for new version releases)


Merge branch one into branch two. Add no-ff option for no-fast-forward merge.


Rebase feature branch onto main(to incorporate new changes made to main). Prevents unnecessary merge commits into the feature, keeping history clean.

It cleans up a branch commits before rebasing onto the main

Undoing Things

  • Move (or rename) a file and stage move.
  • Remove a file from the working directory & staging area, then stage the removal.
  • Remove from staging area only

View previous commit (READ only)

  • Create a new commit, reverting the changes from a specified commit.
  • Go back to a previous commit & delete all commits ahead of it (revert is safer). Add –hard flag to also delete workspace changes (Be very careful)

Review your Repo

  • List new or modified files not yet committed.
  • List commit history, with respective IDs.
  • Show changes to unstaged files. For changes to staged files, add –cached option.
  • Show changes between two commits


Store modified & staged changes. To include untracked files, add -u flag. For untracked & ignored files, add -a flag.

  • Partial stash. Stash just a single or collection of files or individual changes within the files.
  • List all stashes
  • Re-apply the stash without deleting it.
  • Re-apply the stash at index 3, then delete it from the stash list. Omit stash@{n} to pop the most recent stash.
  • Show the diff summary of stash 1. Pass the -p flag to see the full diff.
  • Delete stash at index 1. Omit stash@{n} to delete the last stash mode.
  • Delete all stashes


  • Add a remote repo
  • View all remote connections. Add -v flag to view URLs.
  • Remove & Rename a connection
  • Fetch all branches from remote repo (no merge)
  • To Fetch a specific branch
  • Fetch the remote repository copy of the current branch, then merge
  • Move(rebase) your localc changes onto the top of new changes made to the remote repo (for clean, linear history)
  • Upload local content changes to remote repo
  • Upload to a branch (can then pull request)

So, this is all about the quick cheat sheet of git bash commands.

I hope you enjoyed the article and if you found it useful, please share it with your friends and colleagues. If this post helps you, then spread this so that other people can also benefit.

If you have any queries please feel free to post them in the comments section or anything that you want to ask through mail contact.

Thank you😉

Also read,