Git Cheatsheet
Comprehensive Git command cheatsheet with common operations, branching, merging, stashing, and troubleshooting. Free, private, browser-based.
Local processingSetup & Config
git config --global user.name "Name" | Set global username | |
git config --global user.email "email" | Set global email | |
git config --list | Show all config | |
git config --global core.editor vim | Set default editor | |
git config --global alias.co checkout | Create alias |
Basics
git init | Initialize new repo | |
git clone <url> | Clone a repo | |
git status | Show working tree status | |
git add <file> | Stage file | |
git add . | Stage all changes | |
git commit -m "msg" | Commit staged changes | |
git commit -am "msg" | Stage tracked + commit | |
git push origin main | Push to remote | |
git pull | Fetch + merge | |
git fetch | Fetch without merge |
Branching
git branch | List branches | |
git branch <name> | Create branch | |
git checkout <branch> | Switch branch | |
git checkout -b <name> | Create + switch | |
git branch -d <name> | Delete branch | |
git branch -D <name> | Force delete branch | |
git branch -m <new> | Rename current branch | |
git push -u origin <branch> | Push new branch upstream |
Merging & Rebasing
git merge <branch> | Merge branch into current | |
git merge --no-ff <branch> | Force merge commit | |
git rebase <branch> | Rebase onto branch | |
git rebase -i HEAD~3 | Interactive rebase last 3 | |
git rebase --abort | Cancel rebase | |
git rebase --continue | Continue after conflict | |
git cherry-pick <commit> | Apply specific commit |
Inspecting
git log | Show commit history | |
git log --oneline --graph | Compact graph log | |
git log -p | Log with diffs | |
git diff | Show unstaged changes | |
git diff --staged | Show staged changes | |
git show <commit> | Show commit details | |
git blame <file> | Show who changed each line |
Stashing
git stash | Stash changes | |
git stash save "msg" | Stash with message | |
git stash list | List stashes | |
git stash pop | Apply + drop latest stash | |
git stash apply | Apply latest stash | |
git stash drop | Drop latest stash | |
git stash clear | Drop all stashes |
Undo & Fix
git reset HEAD <file> | Unstage file | |
git reset --soft HEAD~1 | Undo last commit, keep changes | |
git reset --hard HEAD~1 | Undo last commit, discard changes | |
git revert <commit> | Create undo commit | |
git checkout -- <file> | Discard file changes | |
git clean -fd | Remove untracked files/dirs | |
git reflog | Show reference log | |
git bisect start | Start binary search for bug |
Remote
git remote -v | List remotes | |
git remote add origin <url> | Add remote | |
git remote set-url origin <url> | Change remote URL | |
git push --force-with-lease | Safe force push | |
git fetch --prune | Fetch + remove deleted branches |
What is Git Cheatsheet?
Git is a distributed version control system. This cheatsheet provides a quick reference for the most common Git commands organized by category: setup, basics, branching, merging, inspecting, stashing, and troubleshooting.
How It Works
The tool displays a searchable, categorized list of Git commands with descriptions. A filter input narrows results by command or description text.
Common Use Cases
- Quick lookup of Git commands
- Learning Git workflow
- Troubleshooting Git issues
Technical Details
Static reference data rendered as a searchable table. All filtering is client-side. No network requests.
How to Use
- Browse commands by category
- Use the filter box to search
- Copy any command with the copy button
Privacy
All processing happens in your browser. Your data is never uploaded to any server.
FAQ
Does this cover advanced Git commands?
Yes. It includes basic operations, branching, merging, rebasing, stashing, reflog, cherry-pick, bisect, and common troubleshooting scenarios.
Can I search for specific commands?
Yes. Use the filter box to search across all commands and descriptions.