I made the wrong file commit. I did not push the commit to the server.
How can I undo these commits?
I made the wrong file commit. I did not push the commit to the server.
How can I undo these commits?
You can do it using the command git reset HEAD~
or git reset HEAD~1
that allows you to pass the changes of the last commit to the work area. HEAD~
means that it moves back one position with respect to the last commit ( HEAD
).
git revert HEAD
Do not delete the commit, create a new one where the last commit is reversed.