Git Command Generator

Pick what you want to do in Git, fill in the blanks, and get the exact command explained flag by flag.

Command

What it does

    No uploads. Your files stay on your device.

    Free forever, no sign-up, no cookies. Buy me a coffee

    How it works

    Pick the thing you are trying to do — undo the last commit, delete a remote branch, squash commits, revert, rebase, stash, retag a release — fill in the branch name or commit hash, and the exact Git command is written for you as you type. Values that contain spaces or shell characters are quoted and escaped automatically, so you can paste the command straight into your terminal. Every task comes with a short plain English explanation of what each flag does and a warning when the command rewrites history or throws work away.

    The generator is a lookup table plus string building that runs entirely in your browser — no Git repository is read, nothing is executed, and the branch names, commit hashes and repository URLs you type are never sent anywhere. Use “Copy command” for a one-off, or “Download .sh” to keep a small runnable script.

    Frequently asked questions

    How do I undo the last Git commit?

    Run git reset --soft HEAD~1 to remove the commit while keeping every change staged, ready to recommit. Use --hard instead of --soft only if you also want the changes thrown away — that is not recoverable from your working tree. Pick "Undo the last commit" above and set how many commits to roll back; the generator writes the command for you and warns you when it is destructive.

    How do I delete a remote Git branch?

    Use git push origin --delete <branch> (the short form git push origin :<branch> does the same thing). That only removes the branch on the remote — delete your local copy separately with git branch -d <branch>, and tell teammates to run git fetch --prune so their stale references disappear too.

    Should I use git revert or git reset to undo a pushed commit?

    Use git revert <hash> for anything already pushed: it adds a new commit that undoes the changes, so nobody's history breaks. git reset rewrites history and should be kept for local commits only — if you reset something already shared you have to force-push, which can destroy other people's work.

    Report a bug