Skip to content

Instantly share code, notes, and snippets.

@srpatcha
Created March 21, 2018 19:29
Show Gist options
  • Save srpatcha/cdb44178a7ca560c51ee4c3ca08b3331 to your computer and use it in GitHub Desktop.
Save srpatcha/cdb44178a7ca560c51ee4c3ca08b3331 to your computer and use it in GitHub Desktop.
Remove the latest commit in git repo
git log
git reset --hard HEAD~1 // for latest
git reset --hard <sha1-commit-id> // for commit ID or specific 5th commit HEAD~5
git log
git push origin HEAD --force
@srpatcha
Copy link
Author

srpatcha commented Mar 21, 2018

git reset --hard origin/branch // for remote reset but you your loose local changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment