Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

How to undo the most recent local commits in Git

$ git commit -m "Your wrong commit" 		   # (0: Your Accident)
$ git reset HEAD~                              # (1)
[ edit files as necessary ]                    # (2)
$ git add .                                    # (3)
$ git commit -c ORIG_HEAD                      # (4)
// with -c ORIG_HEAD will open an editor, which initially contains the log message from the old commit and allows you to edit it. If you do not need to edit the message, you could use the -C option
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #undo #local #commits #Git
ADD COMMENT
Topic
Name
7+1 =