In this article, I write down a quick git commands cheat sheet, which will include commands that developers use every day

Here, we have listed some most useful git commands:

$ git init

Initialize a Local Git Repository

$ git add <file>

$ git add .

Add one or more files to staging area.

$ git status

Check the status of your current repository and list the files you have made changes.

$ git log

 Provides a list of all the commits made on your branch

$ git commit -m "commit messgae"

Commit changes to Index but not to the remote repository.

$ git push origin <branch name>

 Push the branch to the remote repository so that other can use it

$ git pull

 The git pull command fetches all the changes from a remote repository to a local repository

$ git clone

 The git clone Creates a Git Repository copy from a remote source

$ git diff

 View the changes you have made to the file

$git config -global user.name "your_name"

 This command tells Git who you are by configuring the author name

$ git config -global user.email <your_emailId>

 This command tells Git who you are by configuring the author email

$ git remote add origin <server>

 This Commands Connect your local repository to the remote server and add the server to be able to push changes to it

$ git branch <branch_name>

 The Git Branch Creates a new branch

$ git checkout <branch name>

 Using git checkout we can switch from one branch to another branch

$ git merge <branch name>

Using git Merge we can a branch into the active branch

To reset large merge before push

git reset --hard origin/dev

To checkout myBranch that exists remotely and not a locally

git fetch --all
git checkout myBranch

Found this article helpful?

TutsCoder tutorials are free and ad-light — supported by readers like you. Buy me a coffee (or two ☕☕) as a token of appreciation and help keep Angular & Node.js content coming!

One-time. No subscription. 100% optional. 🙏 Every coffee counts!

Leave a Comment

Your email will not be published. Spam-free zone. ✌️

Available for Projects

Need Help With Your
Angular or Node.js Project?

7+ years of MEAN Stack experience. I build scalable Angular 21 apps, Node.js APIs, and SaaS products — delivered on time, every time.

7+ Years MEAN Stack Angular 21 + Nx Expert 20+ Projects Delivered Remote / Freelance