Monday, 29 February 2016

Git - Undo previous commit and push

If you have commited and pushed a change to the repository and you want to undo those changes, do the follow:
1. Open the terminal
2. Type

git log

This will give you a list of commits, with the text and the hash code
3. Then type

git revert --no-commit HASH_CODE

Where HASH_CODE is the hash code of the specific commit.

The changes will be in stage. All you have to do now is commit and push.

No comments:

Post a Comment