Welcome to my blog!

Git Cheatsheet

Common git commands for daily use

Git Cheatsheet

Published At


Reading Time

~ 10 min read

git branchList all local branches.
git branch -aList remote and local branches.
git checkout -b branch_nameCreate a local branch and switch to it.
git checkout branch_nameSwitch to an existing branch.
git push origin branch_namePush branch to remote.
git branch -m new_nameRename current branch.
git branch -d branch_nameDelete a local branch.
git push origin :branch_nameDelete a remote branch.
git log --onelineShow commit history in single lines.
git log -2Show commit history for last N commits.
git log -p -2Show commit history for last N commits with diff.
git diffShow all local file changes in the working tree.
git diff myfileShow changes made to a file.
git blame myfileShow who changed what & when in a file.
git remote show originShow remote branches and their mapping to local.
git clean -fDelete all untracked files.
git clean -dfDelete all untracked files and directories.
git checkout -- .Undo local modifications to all files.
git reset HEAD myfileUnstage a file.
git pull --tagsGet remote tags.
git checkout tag_nameSwitch to an existing tag.
git tagList all tags.
git tag -a tag_name -m "tag message"Create a new tag.
git push --tagsPush all tags to remote repo.
git stash save "stash name" && git stashSave changes to a stash.
git stash listList all stashes.
git stash popApply a stash and delete it from stash list.


Do you have any questions, or simply wish to contact me privately? Don't hesitate to shoot me a DM on Twitter.

Have a wonderful day.
Abhishek 🙏

Join My Exclusive Newsletter Community

Step into a world where creativity intersects with technology. By subscribing, you'll get a front-row seat to my latest musings, full-stack development resources, and exclusive previews of future posts. Each email is a crafted experience that includes:

  • In-depth looks at my covert projects and musings to ignite your imagination.
  • Handpicked frontend development resources and current explorations, aimed at expanding your developer toolkit.
  • A monthly infusion of inspiration with my personal selection of quotes, books, and music.

Embrace the confluence of words and wonder, curated thoughtfully and sent straight to your inbox.

No fluff. Just the highest caliber of ideas.