PocketPlay
中文

Git Cheat Sheet

A searchable Git command reference grouped by task — branching, remotes, undoing, stash, rebase, worktree — with one-click copy.

🔒 Runs in your browser — files never leave your deviceFree · No sign-up

Placeholders

<branch>, <file>, <remote> and <commit> are placeholders — replace them with your own names. Commands that rewrite history are marked rewrites history; avoid them on branches other people have already pulled.

How to use this Git cheat sheet

  1. Type what you want to do — "undo", "rename branch", "stash" — and the list filters as you type, in English or Chinese.
  2. Jump straight to a section with the category chips: branching, remotes, undoing changes, rebase, worktree and more.
  3. Press the copy button next to a command, paste it into your terminal and replace the <placeholders> with your own branch and file names.

FAQ

Which commands are dangerous?

Anything marked rewrites historygit rebase, git commit --amend, git reset --hard and force pushes. They are perfectly safe on commits that only exist on your machine, but they break other people's clones once the commits have been pushed and pulled.

How do I undo the last commit but keep my changes?

git reset --soft HEAD~1 moves the branch back one commit and leaves everything staged. Use --mixed (the default) to unstage them as well, and --hard only when you really want the changes gone.

Does this page send anything anywhere?

No. It is a static reference — the search and the copy button run entirely in your browser, and nothing you type is recorded or uploaded.