Skip to content

Git Commands Helper

Searchable git command cheat sheet grouped by task. Filter, click to copy, and grab the command you forgot.

You know what you want to do. You just forgot the flag.

That’s the whole reason this page exists. You want to undo the last commit but keep the changes, or you need to push a branch and set its upstream, and the exact wording slips your mind. So you open a new tab, search, scroll past three blog intros, and finally find the line. Annoying.

Here you type what you’re trying to do, like “undo” or “stash” or “rename branch,” and the matching commands surface instantly. No scrolling through a 4,000-word tutorial. Click a command, it’s on your clipboard, you paste it in your terminal. Done.

What’s in here

The commands are grouped by task, the way you actually think about them:

  • Setup and config for your first five minutes with a new machine or repo
  • Staging and committing, including git add -p for picking changes hunk by hunk
  • Branching with the newer git switch syntax alongside the classic checkout -b
  • Merging and rebasing, plus how to bail out when a rebase goes sideways
  • Undo and reset, the section you’ll bookmark, with soft, mixed, and hard reset spelled out
  • Stash, remotes, logs, and tags rounding out the daily workflow

Every entry pairs the command with a one-line plain-English note. No man-page jargon. Just “what does this actually do.”

How to use it

Type a keyword in the search box. It checks the command text, the description, and the group name all at once, so searching “remote” finds git remote -v and git push both. Use the dropdown if you’d rather browse one category at a time. Found the one you need? Click it. It copies. There’s also an export button that dumps the entire sheet to a plain text file you can keep in a gist or pin somewhere handy.

A few that trip people up

git reset --hard HEAD~1 deletes the last commit and its changes permanently. git reset --soft HEAD~1 deletes the commit but keeps the changes staged. One word, very different outcome. Read the description before you run either.

For rewriting history that’s already pushed, use git push --force-with-lease instead of plain --force. The lease version refuses to overwrite work a teammate pushed while you weren’t looking. It’s saved more than one Friday afternoon.

And if you ever think you lost a commit after a bad reset, run git reflog. Git keeps a record of everywhere HEAD has been. The “lost” commit is usually still there, waiting for you to check it out again.

FAQ

Are these the real, current commands?

Yep. Everything here matches modern Git, including git switch and git restore, which replaced a lot of the overloaded checkout behavior. The older checkout -b is listed too, since plenty of repos and habits still use it.

Does clicking actually copy to my clipboard?

It does. One click puts the full command on your clipboard and the button flashes “Copied” so you know it worked. Then paste it straight into your shell.

Can I download the whole list?

Hit the export button and you’ll get a .txt cheat sheet with every command and its note, grouped by task. Drop it in a gist or your dotfiles for offline reference.

Do you send my searches anywhere?

Nope. The command list is baked into the page and the filtering happens right in your browser. Nothing you type leaves your machine.

I searched something and got nothing. Why?

The dataset covers common everyday commands, not every obscure plumbing flag. Try a broader word. Searching “history” works better than a specific option you half-remember.

git version-control cheat-sheet reference cli

Related Tools

More in Developer Tools