Git Command Builder & Emergency Fixer
Quickly resolve common Git accidents, build complex Git commands with customized parameters, and browse an instant emergency cheat code reference.
Completely safe. Your code modifications remain untouched and ready in the staging area.
Customize Parameters
git reset --soft HEAD~1How This Command Works
git reset --soft HEAD~1→Moves HEAD pointer back by 1 commit(s). All file edits stay in the staging index (green in git status).
Git Emergency Cheat Code Matrix
Fast, copyable terminal snippets for daily Git operations, disaster recovery, and everyday workflows.
git reset --soft HEAD~1safegit reset HEAD~1safegit reset --hard HEAD~1destructivegit restore .destructivegit clean -fddestructivegit merge --abortsafegit rebase --abortsafegit rm --cached <file>safegit commit --amend -m "new message"safegit commit --amend --no-editsafegit cherry-pick <hash>safegit revert <hash>safegit checkout -b <branch>safegit branch -m <new-name>safegit push origin --delete <branch>destructivegit branch -d <branch>safegit branch -D <branch>destructivegit branch -asafegit pull --rebase origin maincautiongit stash push -m "note"safegit stash push -u -m "note"safegit stash popsafegit stash applysafegit stash listsafegit stash cleardestructivegit reflogsafegit checkout -b <new-branch> <hash>safegit log --graph --oneline --decorate --allsafegit diff HEAD~1 HEADsafegit blame -L 1,50 <file>safegit push --force-with-lease origin <branch>cautiongit remote -vsafegit fetch --prunesafeWhy Developers Keep This Git Fixer Bookmarked
Built to rescue your repository when things go wrong, without panic and without losing code.
Safety-First Guidance
Every generated command carries an explicit safety badge (Safe, Caution, Destructive) so you know exactly what touches your disk and remote history.
Reflog & Disaster Recovery
Step-by-step commands to bring back "deleted" branches, discarded commits, and aborted rebases using Git reflog snapshots.
Safe Force Pushing
Encourages git push --force-with-lease instead of reckless force-pushing, preventing accidental overwrites of your teammates' work.
100% Client-Side & Private
All command building and filtering occurs completely in your web browser. No repository names, paths, or code ever leave your machine.
3-Step Golden Rule for Git Emergencies
What to do the moment you make a mistake in your Git repository.
1. Don't Panic & Check Working State
Run git status before typing any reset or clean command. Know whether your changes are uncommitted, staged, or already committed.
2. Consult git reflog Before Hard Resets
Git almost never loses committed data immediately. If you accidentally reset or delete a branch, git reflog holds the commit hash for days.
3. Use Non-Destructive Solutions First
Prefer git reset --soft over --hard, git restore over git checkout, and git stash over discarding changes so you always have a fallback.
Frequently Asked Questions About Git Emergencies
Technical insights to help you master Git history, undo mechanisms, and safety best practices.
What is the exact difference between git reset --soft, --mixed, and --hard?
git reset moves the HEAD branch pointer backward. --soft leaves all modified files in the staging area (ready to re-commit). --mixed (the default) leaves your file edits in the working directory but unstaged. --hard wipes out all file modifications and resets both the index and working directory to match the target commit, permanently discarding uncommitted work.
Can I recover a commit or branch that I deleted with git reset --hard?
Yes! As long as the work was committed at least once, Git keeps unreachable commit objects in its local repository for at least 30 days before garbage collection runs. Run `git reflog` to find the commit hash from before your reset, then run `git checkout -b recovered-branch <commit-hash>` to resurrect it.
Why should I use git push --force-with-lease instead of git push --force?
Standard `git push --force` blindly overwrites the remote branch even if someone else pushed new commits while you were working. `git push --force-with-lease` checks whether the remote ref matches your local tracking branch before overwriting. If a teammate has pushed newer commits, the push will be safely rejected instead of destroying their work.
I accidentally committed an API secret or password. How do I remove it?
First, immediately revoke and rotate the credential. If the commit is only local, run `git reset --soft HEAD~1` and remove the secret. If the commit was already pushed to a remote repo, you must purge it from git history using `git-filter-repo` (recommended by Git) or `git filter-branch`, and force-push the updated tree.
How does git stash work and how do I include new untracked files?
By default, `git stash` only stores modified tracked files. To also stash new files you just created (untracked files), add the `-u` (or `--include-untracked`) flag: `git stash push -u -m "my stash note"`. You can retrieve your work anytime with `git stash pop`.
How do I safely stop or cancel a messy merge or rebase conflict?
To cancel a merge in progress, run `git merge --abort`. To cancel an interactive or standard rebase in progress, run `git rebase --abort`. Both commands immediately exit the conflict resolution state and restore your working directory and branch pointer to exactly how they were before you started.
Explore Related Developer & DevOps Tools
Complement your workflow with free, private, browser-native utility suites.
