git · searchable · 60+ commands · local

Searchable Git cheatsheet

The essential Git commands in one searchable view — branches, rebases, stashes, tags, reflog. Click any row to copy. Runs entirely in your browser.

Git Cheatsheet
Sections
7
categories
Commands
52
total
Visible
52
all
Engine
git
v2.x
Filter:
commands
Setup & config
git --version
git config --global user.name "You"
git config --global user.email you@x
git config --global init.defaultBranch main
git init
git clone <url>
git clone --depth 1 <url>
Staging & committing
git status
git add <file>
git add -p
git reset <file>
git commit -m "msg"
git commit --amend
git rm <file>
git mv <a> <b>
Branching
git branch
git branch -a
git branch -d <name>
git switch <branch>
git switch -c <name>
git merge <branch>
git merge --abort
git rebase <branch>
git rebase -i HEAD~3
git rebase --continue
Remote
git remote -v
git remote add <name> <url>
git fetch --all --prune
git pull --rebase
git push -u origin <branch>
git push --force-with-lease
git push --tags
Inspection
git log --oneline --graph --decorate
git log --author=name
git show <sha>
git diff
git diff --staged
git blame <file>
git shortlog -sn
Undoing
git restore <file>
git restore --staged <file>
git reset --soft HEAD~1
git reset --hard HEAD~1
git revert <sha>
git clean -fd
Stash & tags
git stash
git stash pop
git tag -a v1.0.0 -m msg
git push origin v1.0.0
git cherry-pick <sha>
git reflog
git worktree add <path> <branch>
meaning
Setup & config
Show installed Git version
Set committer name
Set committer email
Default new repos to main
Initialize a new repo
Clone a remote repository
git clone git@github.com:o/r.git
Shallow clone (latest commit only)
Staging & committing
Show working tree status
Stage specific file
Stage hunks interactively
Unstage file (keep changes)
Commit staged changes
Modify last commit
Remove file from index and disk
Move/rename a tracked file
Branching
List local branches
List all incl. remotes
Delete branch (safe)
Modern: switch branches
Modern: create + switch
Merge branch into current
Abort an in-progress merge
Rebase current onto branch
Interactive rebase last 3
Continue rebase after conflicts
Remote
List remote URLs
Add a remote
Fetch all + prune deleted
Fetch + rebase onto upstream
Push and set upstream
Safer force-push
Push local tags to remote
Inspection
Compact graph view
Filter log by author
Show details of a commit
Unstaged changes
Staged changes vs HEAD
Show who changed each line
Commit count per author
Undoing
Discard unstaged changes
Unstage file
Undo last commit, keep staged
Discard last commit entirely
Create commit that reverses <sha>
Remove untracked files & dirs
Stash & tags
Stash dirty working tree
Apply + drop latest stash
Create annotated tag
Push a single tag
Apply commit from another branch
Show ref history (recover lost commits)
Branch into separate dir
Quick Start

How to use the cheatsheet

Pick a section, filter for keywords, click Copy on any command to grab it.

  1. 01

    Scan sections

    Setup, commits, branching, remote, inspection, undo, stash.

    Inputs are treated as UTF-8 throughout the pipeline and validated client-side as you type — nothing dispatches until the value is well-formed.

    navinpututf-8client-sidevalidated
    sections · text7 · set
    Setup
    Commits
    Branching…
    loaded · parsedclient-side
  2. 02

    Filter

    Type 'rebase' or 'tag' to narrow down.

    Each toggle re-computes through a memoised hook, so flipping options never resets your input and the UI stays snappy on large inputs.

    searchoptionslivememoisedtoggles
    filter · memoisedrebase · live
    rebase ↳ 4 cmds
    options set · memoisedlive
  3. 03

    Copy one

    Per-row Copy button puts the command on your clipboard.

    Randomness — where used — comes from crypto.getRandomValues, never Math.random. Heavy work sits in useMemo.

    copycomputeinstantlocaldeterministic
    cmd · instant1 · computed
    ✓ Copied
    computed · instantinstant
  4. 04

    Copy all

    Get the whole sheet as Markdown to pin in your wiki.

    Copy writes through navigator.clipboard and downloads use a Blob — zero network traffic. Same input plus same options always yield the same bytes.

    bulkcopydownloadzero-networkreproducible
    ok · copiedall · copied
    ✓ Copied all
    shipped · ready to shipsuccess
Pro tips

Pro tips for everyday utilities

Reach for crypto.getRandomValues

Cryptographically random for IDs, tokens, salts. Math.random is for animation and games, not security.

Sort IDs lexicographically

UUID v4 has no time ordering. Use ULID or UUID v7 if you need sorted IDs.

Mock data with seeds

Faker-style libraries can be seeded so tests are reproducible. Embed the seed in the fixture file.

Reference cards beat memory

Cheatsheets for Vim, Git, Docker, Linux signals are faster than man pages when you’re mid-flow.

Browser APIs vary

Touch events, gamepads, and clipboard differ across vendors. Feature-detect before use.

Persist in the right place

localStorage for user preferences, sessionStorage for transient state, IndexedDB for structured data.

Use Cases

When to reach for Git help

Daily commits, sticky rebases, lost work.

Daily commits

Remind yourself of -p staging and amend rules. Random values come from crypto.getRandomValues — cryptographically secure for tokens, salts, and session IDs. Math.random is deterministic enough for animations but predictable enough to be a security bug.

CSPRNG-backed

Stuck rebases

Look up --continue and --abort fast. Pair with hashids, ULID, or UUID v7 when you need both random and sortable — useful for primary keys, public-facing IDs, and event log ordering without a sequence column.

reproducible

Recovering work

Reflog and worktree recipes when something looks lost. Output is deterministic given the same seed, so fixtures and tests stay reproducible across CI runs and contributor machines. Embed the seed in the fixture file for full replay.

snappy

Code reviews

Diff and log incantations to inspect a PR. Heavy work runs through useMemo so the UI stays snappy on large inputs. Same input + same options yields identical bytes — the kind of stability snapshot tests rely on.

feature-detected

Onboarding

Hand a new teammate one searchable reference. Storage tools persist to the right backend: localStorage for user preferences, sessionStorage for transient state, IndexedDB for structured data. Pick the right shelf and quota worries disappear.

deterministic

CI scripts

Look up the right plumbing command quickly. Browser feature detection: clipboard, fullscreen, gamepad, and Web Bluetooth APIs gracefully fall back when unavailable. No surprise white screens on Safari or older Firefox.

production-ready
FAQ

Frequently asked questions

No — it covers the daily 80% with a handful of advanced commands. The Git man pages are still the source of truth.
switch and restore are the modern equivalents. checkout still works but mixes too many concerns.
Always prefer --force-with-lease — it refuses to overwrite work you haven&apos;t seen.
Aliases vary per-user — set your own. The cheatsheet sticks to canonical names.
No. The cheatsheet is static and runs entirely in your browser.
Suggest a tool

Something missing?

Tell us what you need. We ship the top requests every two weeks.

Sent straight to the maintainers · no account needed
47 in queue·8 shipped this month
Request queued. Thanks!