Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

how to undo a commit that has not been pushed

Run the following command to revert the last commit.


$ git reset --soft HEAD~


Note: You can specify multiple commits by placing a number at the end.

For instance, if we want to undo the last two commits,
we can run the following command.


$ git reset --soft HEAD~2
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #undo #commit #pushed
ADD COMMENT
Topic
Name
6+7 =