Git Cheatsheet
Common Git commands organized by workflow
Git Cheatsheet is a free online tool from BrowserUtils that common git commands organized by workflow. It runs entirely in your browser — your data never leaves your device. No account required.
git initInitialize a new Git repository
git clone <url>Clone a remote repository
git config --global user.name "Name"Set your name for commits
git config --global user.email "email"Set your email for commits
git config --listList all configuration settings
git remote add origin <url>Add a remote repository
git remote -vList remote repositories
git statusShow working tree status
git add <file>Stage a specific file
git add .Stage all changes in current directory
git add -pInteractively stage hunks
git commit -m "message"Commit staged changes with message
git commit --amendAmend the last commit
git commit --amend --no-editAmend last commit without changing message
git reset HEAD <file>Unstage a file (keep changes)
git reset --soft HEAD~1Undo last commit (keep changes staged)
git reset --hard HEAD~1Undo last commit (discard changes)
git checkout -- <file>Discard changes in working directory
git restore <file>Discard changes in working directory (modern)
git restore --staged <file>Unstage a file (modern)
git stashStash uncommitted changes
git stash popApply and remove latest stash
git stash listList all stashes
git stash dropDelete latest stash
git branchList local branches
git branch -aList all branches (local + remote)
git branch <name>Create a new branch
git branch -d <name>Delete a branch (safe)
git branch -D <name>Force delete a branch
git switch <branch>Switch to a branch (modern)
git switch -c <branch>Create and switch to new branch
git checkout <branch>Switch to a branch (classic)
git checkout -b <branch>Create and switch to new branch (classic)
git merge <branch>Merge branch into current branch
git merge --no-ff <branch>Merge with a merge commit (no fast-forward)
git rebase <branch>Rebase current branch onto branch
git rebase --abortAbort an in-progress rebase
git rebase --continueContinue rebase after resolving conflicts
git cherry-pick <commit>Apply a specific commit to current branch
git fetchDownload objects from remote (no merge)
git fetch --pruneFetch and remove stale remote branches
git pullFetch and merge remote changes
git pull --rebaseFetch and rebase on remote changes
git pushPush commits to remote
git push -u origin <branch>Push and set upstream branch
git push --force-with-leaseForce push (safer, checks remote state)
git push origin --delete <branch>Delete a remote branch
git push --tagsPush all tags to remote
git logShow commit history
git log --onelineShow commit history (compact)
git log --graph --onelineShow commit graph
git log -p <file>Show changes over time for a file
git diffShow unstaged changes
git diff --stagedShow staged changes
git diff <branch1>..<branch2>Compare two branches
git show <commit>Show details of a specific commit
git blame <file>Show who changed each line of a file
git reflogShow history of HEAD changes
git bisect startStart binary search for a bug
git shortlog -snShow commit count by author
git tagList all tags
git tag <name>Create a lightweight tag
git tag -a <name> -m "msg"Create an annotated tag
git tag -d <name>Delete a local tag
git push origin <tag>Push a specific tag to remote
How to use Git Cheatsheet
- 1 Paste or type your input into the editor above.
- 2 The tool processes your data instantly — right in your browser, with nothing sent to a server.
- 3 Copy the result with one click or continue editing your input.
About Git Cheatsheet
Free online Git cheatsheet. Quick reference for common Git commands organized by workflow: setup, staging, branching, merging, remote, and history. This tool runs entirely in your browser — your data is never sent to a server. Just paste your input, get instant results, and copy with one click. No sign-up or installation required.
Git Cheatsheet specs
- Runtime
- 100% client-side (browser)
- Cost
- Free — no account, no rate limits, no usage caps
- Browser support
- Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
- Part of
- 299 developer tools on BrowserUtils (100% client-side)
Questions
What are the most essential Git commands?
The most essential Git commands are git init, git clone, git add, git commit, git push, git pull, git branch, git checkout/switch, git merge, and git status. These cover the basic workflow of creating, tracking, and sharing changes.
What is the difference between git merge and git rebase?
git merge creates a new merge commit that combines two branches, preserving the full history. git rebase replays commits from one branch onto another, creating a linear history. Rebase is cleaner but should not be used on shared/public branches.
How do I undo the last Git commit?
Use git reset --soft HEAD~1 to undo the commit but keep changes staged, or git reset --mixed HEAD~1 to unstage them as well. Use git revert HEAD to create a new commit that reverses the changes without rewriting history.
How do I resolve a Git merge conflict?
Open the conflicted file and look for the <<<<<<, ======, and >>>>>> markers. Edit the file to keep the code you want, remove the markers, then stage the file with git add and complete the merge with git commit.
Is this Git cheatsheet kept up to date?
Yes. The cheatsheet covers commands compatible with Git 2.x and reflects modern best practices, such as using git switch and git restore instead of the overloaded git checkout command.
Comments
Related tools
More Developer Reference
ASCII TableHTML Entities ReferenceRegex CheatsheetCSS Selectors ReferenceHTML Color NamesKeyboard KeycodesUnicode TableHTML Tags Reference
View all Developer Reference tools
Comments