Skip to content

Instantly share code, notes, and snippets.

@jeffchao
Created October 11, 2013 08:06
Show Gist options
  • Save jeffchao/6931253 to your computer and use it in GitHub Desktop.
Save jeffchao/6931253 to your computer and use it in GitHub Desktop.
Revert git head back to last known specific commit. Typically useful on bad merges.
// Reset the index to the desired tree.
git reset <specific sha>
// Move the branch pointer back to the previous HEAD.
git reset --soft HEAD@{1}
git commit
git push origin master
// Update working copy to reflect the new commit.
git reset --hard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment