Git Command Builder
Pick a workflow scenario, customize parameters, inspect branch history graphs, and copy terminal commands safely.
Undo & Recovery Scenarios
Undo last commit (keep files staged)
Moves HEAD back N commits while keeping all changed files modified and in the staging area.
Executable Terminal Command
git reset --soft HEAD~1
Frequently Asked Questions
How do I undo the most recent Git commit safely?
Run `git reset --soft HEAD~1` to undo the commit while keeping all your changed files staged, or `git reset --hard HEAD~1` to discard all changes completely.
What is the difference between Git merge and Git rebase?
Merge creates a new commit joining two histories together, preserving branch context. Rebase rewrites commit history on top of another branch for a linear log.
How do I recover deleted or lost Git commits?
Use `git reflog` to view a full history of HEAD movements and locate the lost commit SHA, then run `git branch recover-branch <SHA>`.