What this Git command generator does
Git can do almost anything, but remembering whether you need reset --soft, restore --staged or revert at the moment you need it is another matter. This tool flips the problem around: you describe what you want to do, and it gives you the right commands. It contains around 30 curated scenarios covering undoing mistakes, managing branches, rewriting commits, syncing with remotes, stashing, digging through history and cleaning up. Each scenario comes with editable parameters, a plain-language explanation and, for commands that rewrite history or delete work, a clear warning.
How to use it
- Type what you want in the search box, for example "undo last commit" or "rename branch", or browse by category.
- Click a scenario to open it.
- Fill in the parameters, such as branch names, commit hashes or file paths. The commands update as you type.
- Read the explanation and any warning, then copy the commands into your terminal.
Scenarios included
- Undo: undo the last commit while keeping or discarding changes, unstage a file, discard local edits, revert a pushed commit and recover a deleted branch with the reflog.
- Branches: create, rename locally and on the remote, delete, move commits made on the wrong branch, rebase onto the latest main.
- Commits: amend the message, add a forgotten file, squash the last N commits, cherry-pick, abort a conflicted merge, resolve conflicts by taking one side.
- Remotes: force-push safely with
--force-with-lease, sync a fork with upstream, change the remote URL, reset a branch to match the remote. - History and cleanup: stash and restore work, find the commit that introduced a bug with
bisect, search for when text was added, a compact log graph, stop tracking a file, clean untracked files and tag a release.
Safety tips
- Before anything destructive, create a backup branch:
git branch backup-before-fix. - The reflog keeps references to recent commits for about 90 days. Most "lost" work can be recovered with
git reflog. - Never rewrite history on shared branches like
mainwithout coordinating with your team. - Prefer
--force-with-leaseover--force; it refuses to overwrite work you haven't fetched.