Git Cheat Sheet
Essential Git commands organized by workflow stage
Setup & Config
git config --global user.name "Name"git config --global user.email "email"git config --listgit initgit clone <url>git clone <url> --depth 1Staging & Committing
git statusgit add <file>git add .git add -pgit commit -m "message"git commit --amendgit diffgit diff --stagedgit reset HEAD <file>git restore <file>Branching & Merging
git branchgit branch -agit branch <name>git checkout <branch>git checkout -b <branch>git switch -c <branch>git merge <branch>git rebase <branch>git branch -d <branch>git branch -D <branch>Remote
git remote -vgit remote add origin <url>git fetchgit pullgit pull --rebasegit push origin <branch>git push -u origin <branch>git push --force-with-leaseStash
git stashgit stash popgit stash listgit stash apply stash@{n}git stash drop stash@{n}git stash push -m "label"Log & History
git loggit log --onelinegit log --oneline --graph --allgit log -pgit blame <file>git show <commit>git log --author="Name"Undoing & Fixing
git revert <commit>git reset --soft HEAD~1git reset --mixed HEAD~1git reset --hard HEAD~1git clean -fdgit cherry-pick <commit>git reflogTags
git tag v1.0.0git tag -a v1.0.0 -m "msg"git push origin --tagsgit tag -d v1.0.0How to use this Git cheat sheet
This reference covers the most important Git commands every developer uses daily. It is organized by workflow phase — from initial setup through branching, committing, working with remotes, and undoing mistakes. Use the search box to quickly find any command by name or description. Click the copy icon next to any command to copy it to the clipboard. For deeper understanding of any command, run git help <command> in your terminal.
Private & free — this tool runs entirely in your browser.
Recommended: IndieKit — Ship your Next.js startup in days.affiliate
Related Developer Utilities tools
RegExp Tester
Test regular expressions and inspect matches locally.
Regex Visualizer
Visual regex pattern diagram with live match highlighting and capture group annotations.
Subnet Calculator
Compute CIDR subnets, usable hosts, and network ranges.
Cron Parser
Translate cron syntax into plain English.
URL Parser
Break a URL into protocol, host, path, and query parts.
HTML Previewer
Paste HTML and see it rendered live in a safe, sandboxed preview.
HTTP Status Code Reference
Search and look up every HTTP status code and its meaning.
MIME Type Lookup
Find the MIME type for a file extension, or the extensions for a MIME type.