Too Much Tools logoToo Much Tools

Git Cheatsheet

A searchable memo of the git commands you keep forgetting, locally.

Local, Runs entirely in your browser, your data never leaves your device.
Loading tool…

The git commands you look up every few weeks

Most git commands are used rarely enough that the flags don't stick: was it `git restore` or `git checkout` to discard a change, is it `--soft` or `--mixed` for that reset? This memo groups the common ones under Setup & config, Staging & committing, Branches, Remotes & syncing, and History & undo, each with a one-line plain-English description, and a search box filters every group at once by command text or description.

How to use the Git Cheatsheet

  1. Type a keyword into the search box, such as "stash", "undo" or "rebase".
  2. Scan the matching groups; each command keeps its section heading for context.
  3. Read the one-line description next to each command to confirm it's the one you want.
  4. Hover a command and click the copy icon to grab it exactly as shown.
  5. Clear the search box to see the full list again, grouped from setup through history and undo.

The search matches against both the command text and its description, so searching "discard" surfaces `git restore <path>` even though the word "discard" only appears in its description, not the command itself.

This is a fixed, curated list of common commands, not a full manual; it favors the everyday staging, branching and undo workflow over every flag git supports, so obscure porcelain and plumbing commands are not included.

Frequently asked questions

What's the difference between git restore and git reset?
This memo lists `git restore <path>` to discard working-tree changes and `git restore --staged <path>` to unstage a file, while `git reset --soft` or `--hard` rewinds commits themselves, which is a different operation covered separately under History & undo.
How do I undo my last commit without losing the changes?
Use `git reset --soft HEAD~1`, listed under History & undo, which removes the last commit but keeps its changes staged, ready to be re-committed differently or added to.
How do I recover a commit I think I lost?
Search "reflog" to find `git reflog`, which lists every place HEAD has pointed, including commits no longer reachable from any branch, letting you find and check out or cherry-pick a commit you thought was gone.
Does this cheatsheet cover git stash?
Yes, under History & undo you'll find `git stash` to shelve uncommitted changes and `git stash pop` to restore them, both searchable by typing "stash" into the filter box.