Undo Last Git Commit (Keep Changes)

Undo the last commit but keep its changes staged. The safe "oops" command.

Moves HEAD back one commit while keeping all file changes staged. --soft means the commit is undone but the working tree is untouched - opposite of --hard which discards changes.

When you need this: When you just committed but realized you need to add more files or fix the commit message.

Command


        
9 views 0 copies
Log in to rate
Log in to save

Free account. Save snippets into your own collections.