Git Cheatsheet

Runs in browser

Complete Git commands reference. Search across 50+ commands by category.

Complete Git commands reference with descriptions. Search any git command instantly. Covers setup, staging, committing, branching, remote, stashing, history, undoing, and advanced commands.

Git Cheatsheet tool

Click any command to copy · 54 commands across 9 categories

Setup6
git config --global user.name "Name"copy
git config --global user.email "email"copy
git config --listcopy
git initcopy
git clone <url>copy
git clone <url> --depth 1copy
Staging7
git statuscopy
git add <file>copy
git add .copy
git add -pcopy
git reset HEAD <file>copy
git diffcopy
git diff --stagedcopy
Committing4
git commit -m "msg"copy
git commit --amendcopy
git commit -am "msg"copy
git revert <hash>copy
Branching9
git branchcopy
git branch <name>copy
git checkout <branch>copy
git checkout -b <branch>copy
git switch <branch>copy
git switch -c <branch>copy
git merge <branch>copy
git branch -d <branch>copy
git branch -D <branch>copy
Remote7
git remote -vcopy
git remote add origin <url>copy
git fetchcopy
git pullcopy
git pushcopy
git push -u origin <branch>copy
git push --force-with-leasecopy
Stashing5
git stashcopy
git stash popcopy
git stash applycopy
git stash listcopy
git stash dropcopy
History6
git logcopy
git log --onelinecopy
git log --graph --onelinecopy
git show <hash>copy
git blame <file>copy
git bisect startcopy
Undoing4
git reset --soft HEAD~1copy
git reset --hard HEAD~1copy
git clean -fdcopy
git restore <file>copy
Advanced6
git cherry-pick <hash>copy
git rebase <branch>copy
git rebase -i HEAD~3copy
git tag <name>copy
git tag -a <name> -m "msg"copy
git submodule add <url>copy

🔒 Runs in your browser · No uploads · Your data never leaves your device

How to use

  1. Search for a command

    Type in the search box to filter by command name, description, or category.

  2. Browse by category

    Commands are grouped into Setup, Staging, Committing, Branching, Remote, Stashing, History, Undoing, and Advanced.

  3. Copy any command

    Click any command row to copy it to your clipboard instantly.

Common use cases

  • Looking up an infrequently used Git commandSearch by keyword to find the exact command syntax for stashing, rebasing, or cherry-picking without leaving the browser.
  • Onboarding new developers to GitShare the cheatsheet as a quick reference for common Git workflows and branch management commands.

Examples

  • Undo last commit

    Keep changes staged.

    Output
    git reset --soft HEAD~1

Frequently asked questions

What is the difference between git switch and git checkout?
git switch is the modern replacement for git checkout for branch operations. git checkout still works but does too many things. Use git switch for branches and git restore for file changes.
When should I use rebase vs merge?
Use merge to preserve history. Use rebase to keep a linear commit history. Never rebase commits that have been pushed to a shared branch.
What does --force-with-lease do?
It is a safer alternative to --force-push. It fails if someone else has pushed to the branch since your last fetch, preventing accidental overwrites.

Key concepts

Rebase
A Git operation that moves or reapplies commits on top of another branch, creating a linear commit history.
Stash
Temporarily saves uncommitted changes so you can switch branches, then restore them later with git stash pop.

You might find these useful too.

More generators tools