How to undo Git commits ?

You'll need to "reset" the last commit by running the following git command

git reset HEAD~

If you wish to undo more that one git commit, add the number of commits to be undone after the tilda, for example:

git reset HEAD~3

git reset undo your commits and leaves your, previously committed files, in an unstaged state. If you would like to leave the uncommitted files in a staged state, add the parameter --soft to the reset command, for example:

git reset --soft HEAD~2

From here, you can proceed with updating\committing your files.


Popular posts from this blog

Testing SOAP services using pingdom