Monday, September 29, 2014

Git rollback latest changeset

In git to rollback the latest changeset, you do a git reset hard and specify the commit ID of the changeset before that.

For example suppose your latest commit id is fd1793a0a8366bdd48a85f7afe4fe26339f1149c. And the commit id of the previous commit is a6755301e8b283a0c7191028bb7611feff003cdd. To roll back fd1793a0a8366bdd48a85f7afe4fe26339f1149c this is what you do

git reset --hard a6755301e8b283a0c7191028bb7611feff003cdd

This points your Head to a6755301e8b283a0c7191028bb7611feff003cdd, effectively rolling back fd1793a0a8366bdd48a85f7afe4fe26339f1149c.

No comments:

Post a Comment

Comments will appear once they have been approved by the moderator