Reputation: 36344
Just pulled a change that i'd like to reverse, what's the quickest way of rolling back one commit?
Upvotes: 0
Views: 225
Reputation: 318468
git reset --hard HEAD^
HEAD^
means "one before head" and is thus equal to HEAD~1
and means to throw away the most recent commit including all of its changes. If you just want to destroy the commit but keep the files changed remove the --hard
switch.
If you intend to push your updated branch back to the remote containing the commit you undid better do not use git-reset
as it modifies history. Use git revert HEAD
instead. This creates a new commit which reverts all changes from the given commit.
Upvotes: 1