Tools Guides
developer Free No signup

Git Command Cheat Sheet

Interactive reference of 80+ essential Git commands, organized by category with search and favorites.

Loading tool…

About this tool

An interactive Git reference covering 80+ commonly used commands organized into categories: Setup, Basic Workflow, Branching, Remote, Undo, Stash, Log/History, and Advanced. Search commands by keyword, mark favorites for quick access, and click any command to copy it or see a detailed explanation.

How to use

  1. 1 Step 1: Browse commands by category using the tab navigation, or use the search box to find a specific command.
  2. 2 Step 2: Click the copy button next to any command to copy it directly to your clipboard.
  3. 3 Step 3: Click the star icon to mark commands as favorites — they'll be saved and accessible via the Favorites tab.
  4. 4 Step 4: Enable 'Explain' mode and click any command to see a detailed explanation with examples and use cases.

A searchable reference for the commands you keep forgetting

Git has hundreds of commands and flags, but most daily work draws on a few dozen. The trouble is remembering the exact syntax under pressure — the difference between reset --soft and reset --hard, or how to safely undo a push. This cheat sheet collects the commands that matter, organised into the categories you actually think in: Setup, Basic Workflow, Branching, Remote, Undo, Stash, Log/History, and Advanced. Each entry shows the command, a one-line description, and a real example you can copy with a single click.

How to use it: tabs, search, and Explain mode

Three controls make this faster than scrolling a long list. Category tabs jump straight to a group — click "Branching" to see only branch commands. Search matches across both command text and descriptions at once, so typing undo surfaces relevant commands even though the word "undo" is in the description, not the command. And Explain mode is the key feature: tick it, then click any command to expand a paragraph describing what it really does, with its own worked example. That turns the sheet from a list of strings into something that teaches the why, not just the what.

Favorites that persist

Every command has a star. Click it and the command is added to a Favorites tab, and that list is saved in your browser's local storage — so the handful of commands you reach for daily are still there the next time you open the page. There is no account and no sync; the favorites live on your device. The Copy button next to each command puts just the command text on your clipboard and flashes a brief "Copied!" confirmation.

A worked example: undoing your last commit

Suppose you committed too early. Open the Undo tab and you will see three resets that look almost identical but behave very differently — this is exactly where people get burned:

CommandMoves HEAD back?Your changes
git reset --soft HEAD~1YesKept, still staged
git reset --mixed HEAD~1YesKept, unstaged
git reset --hard HEAD~1YesDiscarded permanently

Turn on Explain mode and click git reset --hard HEAD~1: it warns that the change "cannot be undone easily." For undoing a commit you have already pushed, the sheet points you instead to git revert, which creates a new commit that reverses the old one — safe for shared branches because it rewrites no history.

The safety distinctions worth internalising

  • --force versus --force-with-lease. A plain force push can clobber a teammate's work. git push --force-with-lease only succeeds if nobody has pushed since your last fetch — the sheet recommends it for exactly this reason.
  • Reset versus revert. Reset moves history and is fine on local, unpushed commits; revert adds an undo commit and is the right tool once others have your commits.
  • Merge versus rebase. Merge preserves the branch shape with a merge commit; rebase replays your commits for a linear history. The sheet lists both with notes on when each fits.
  • git reflog is your safety net. If a reset loses a commit, reflog shows where HEAD pointed recently so you can recover it — one of the most reassuring commands to know exists.

Beyond the basics

The Advanced tab covers the commands that feel like magic once you meet them: git cherry-pick to lift a single commit onto another branch, git rebase -i to squash and reorder commits before a merge, git bisect to binary-search history for the commit that introduced a bug, and git worktree to check out two branches in two folders at once. The Stash tab covers saving half-finished work out of the way, and Log/History covers reading the past — git log --oneline --graph --all for a visual branch map, git blame to find who last touched a line.

Common mistakes this sheet helps you avoid

  • Reaching for --hard when you meant --soft. Read the Explain text before running a reset you cannot undo.
  • Using commit -am and expecting new files to be included. The note makes clear it only stages already-tracked files, not new untracked ones.
  • Amending or force-pushing shared branches. The entries flag which commands rewrite history and should stay on your local work.

Everything runs in your browser. There is no Git execution here and nothing is sent anywhere — it is a fast, private, copy-ready reference that remembers your favorites between visits.

Frequently Asked Questions

{# Alpine.js — self-hosted. (The previous jsdelivr CDN tag had a stale SRI integrity hash, so the browser refused to run it and window.Alpine was never defined — silently breaking every FAQ accordion and Alpine tool.) #}