How to use the Git Command Helper
- Type what you want to do, or pick a category.
- Read the command and the note about when to use it.
- Copy the command into your terminal.
What does this tool do?
Git has hundreds of commands and options, but most days you need a few dozen. This helper covers everyday work, branching, undoing mistakes, stashing, history, remotes and tags.
Each recipe says when it's safe — for example, amending and resetting rewrite history, so use them only on commits you haven't pushed.
Why use it?
- Search in plain English.
- Safety notes on risky commands.
- One-click copy.
Use cases
- Find a command without searching forum threads.
- Recover from common mistakes.
- Learn git step by step.
Undoing things safely
Which command to use depends on whether you've pushed:
| You want to… | Command |
|---|---|
| Undo the last commit but keep the changes | git reset --soft HEAD~1 |
| Discard changes to one file | git restore <file> |
| Undo a commit that's already pushed | git revert <commit> |
| Fix the last commit message | git commit --amend |
Common mistakes
- Rewriting history (reset, amend, rebase) on commits others have pulled.
- Using git push --force on shared branches — prefer --force-with-lease.
- Running commands you don't understand on important work — make a backup branch first.
Privacy
The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved. There's no account to create and nothing to install.
Frequently asked questions
What's the difference between reset and revert?
reset moves your branch back, rewriting history; revert adds a new commit that undoes an old one, which is safe after pushing.
How do I save work without committing?
git stash, then git stash pop to bring it back.
Can I recover a deleted branch?
Often yes — git reflog shows recent commits you can check out again.
Content last updated . See how M2Toolkit works.