undo git reset

git reset soft HEAD~1 // undo last commit but keep the change

git reset hard HEAD~1 // undo last commit and discard the committed change

Undo the commit:

git reflog
3f6db14 HEAD@{0}: HEAD~: updating HEAD
d27924e HEAD@{1}: checkout: moving from d27924e0fe16776f0d0f1ee2933a0334a4787b4c
git reset HEAD@{1} (or git reset d27924e)

REF:

http://stackoverflow.com/questions/927358/how-do-you-undo-the-last-commit

http://stackoverflow.com/questions/2510276/undoing-git-reset

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s