Git Reset Command for Undoing Last Commit

💡 Git Tip That Saved My Day Ever made a commit and immediately realized it was wrong? Here's your escape: git reset --soft HEAD~1 This command: ✓ Undoes the last commit ✓ Keeps your changes in staging area ✓ Lets you commit again with right message Other useful commands: git reset --hard HEAD~1 (undo + remove changes) git revert HEAD (safe undo for pushed commits) git cherry-pick (copy specific commits) Real story: Earlier today, I committed "Fix bug" but should've written "Fix API authentication bug". Used git reset and fixed it. Problem solved! 😅 What's your most-used Git command? Share in comments! #Git #GitHub #WebDevelopment #CodingTips #Developer

To view or add a comment, sign in

Explore content categories