cd ..
Developer
Oh Sh*t, Git!
Messed up a git commit, merge, or push? Get the exact git commands to fix your mistake — undo commits, reset branches, recover deleted files, and more. Free.
git reset undo commitgit revert pushed commitundo git mergefix git mistakesgit command generator
Solution Sequence
> You just committed, but realized you forgot to save a file or need to make one tiny tweak. You don't want a whole new commit for it.
// Add your forgotten changes
git add <forgotten-file>// Amend the previous commit without changing its message
git commit --amend --no-editFrequently Asked Questions
How do I undo the last git commit without losing changes?+
Use 'git reset --soft HEAD~1' — this moves your commit back to staging without deleting your changes.
How do I revert a commit I already pushed?+
Use 'git revert <commit-hash>' to create a new commit that reverses the changes without rewriting history.