Git Command Generator
Every engineer has Googled “how do I undo the last commit” at least twice. Instead of guessing between reset --soft, reset --mixed and reset --hard, pick the task from a list and the generator prints the exact command, with your branch, commit SHA or tag name filled in.
How to generate a Git command
-
1
Pick the task
Undo last commit, amend message, rebase onto main, cherry-pick, force-reset to remote, tag a release…
-
2
Fill in the parameters
Branch name, commit SHA, tag: only the fields each task needs.
-
3
Read the command
The tool assembles the right flags in the right order.
-
4
Copy and run
Paste into your terminal; the command is a drop-in line, not pseudo-code.
Tasks it covers
| Task | Command produced |
|---|---|
| Undo last commit (keep staged) | git reset --soft HEAD~1 |
| Amend last commit message | git commit --amend -m "…" |
| Discard all uncommitted changes | git restore . + git clean -fd |
| Create + switch to a new branch | git checkout -b feature/x |
| Delete branch locally + remotely | git branch -d x + git push origin --delete x |
| Sync feature branch with main | git fetch origin + git rebase origin/main |
| Cherry-pick a commit | git cherry-pick <sha> |
| Revert a commit (safe) | git revert <sha> |
| Tag and push a release | git tag -a v1.0.0 -m "…" + git push origin v1.0.0 |
| Force-reset local to remote | git fetch origin + git reset --hard origin/main |
Commands marked safe vs destructive
- Safe (rewind-able):
commit,switch,checkout -b,revert,tag. - Destructive on local working tree:
restore .,clean -fd,reset --hard. - Destructive on shared history:
push --force,filter-repo,rebaseon branches others use.
Tip: dry-run risky commands
Before git clean -fd, run git clean -nd, the -n flag prints what would be deleted without deleting. Same idea for git rm: read git status first.
Frequently Asked Questions
Because “undo” means different things. reset --soft HEAD~1 keeps your changes staged so you can re-commit; --mixed unstages them; --hard throws them away. The generator lets you pick the intent instead of memorising flags.
revert creates a new commit that undoes an old one, safe on a shared branch because history is preserved. reset rewinds the branch pointer, which changes history and requires a force push if the branch is shared.
Yes, for the “remove a file from all history” task. It is safer and faster than the deprecated filter-branch; you must install it separately (brew install git-filter-repo or via pip).
No. It only prints the command, running it is always your decision, so you can review flags and context before touching the repo.
Related Tools
ASCII Table Reference
Full ASCII table from 0 to 127 with decimal, hex, octal, binary, standard names and HTML numeric-reference notation, including NUL, LF and DEL.
Color Palette Generator
Generate monochromatic, analogous, complementary, triadic or tetradic color palettes from a base HEX color and export copy-ready CSS variables.
HTML Character Reference
Searchable list of HTML entities, their named and numeric codes, and a one-click copy for special characters and symbols.
HEX Color Picker
Pick or enter a HEX colour and get RGB, HSL, approximate CMYK, relative luminance and contrast ratios against white and black.
FPS Counter
Measure browser FPS with requestAnimationFrame, smoothing, min/max frame rate, warnings and an optional graph. Runs locally with no upload or API.
JSON Formatter
Paste JSON to pretty-print with 2 or 4 spaces, minify it to compact output, or run a quick syntax check before copying the result.
Tool available in other languages
- Trình tạo lệnh Git [VI]
- Générateur de commandes Git [FR]
- Generator Perintah Git [ID]
- مولد أوامر Git [AR]
- Git 명령어 생성기 [KO]
- Git-Befehlsgenerator [DE]
- Gitコマンドジェネレーター [JA]
- Git-kommandogenerator [SV]
- Generador de Comandos Git [ES]
- Git-commandogenerator [NL]
- เครื่องสร้างคำสั่ง Git [TH]
- Generator komend Git [PL]
- Gerador de Comandos Git [PT]
- Generatore di Comandi Git [IT]
- Генератор команд Git [RU]
- Git Komut Oluşturucu [TR]
- Git命令生成器 [ZH]