Wednesday, March 21, 2012

Revert in Git

1) If you have already committed your changes and want to “undo” the changes

git revert  $id

where $id is the commit id

This will create a second commit which undoes the changes of the given commit.

2)  Revert the last commit

git revert HEAD

3) Return to the last commited state

git reset --hard

No comments: