Skip to content

Instantly share code, notes, and snippets.

@rgsingh
Created July 28, 2015 02:01
Show Gist options
  • Save rgsingh/a2c3232c0735928905ed to your computer and use it in GitHub Desktop.
Save rgsingh/a2c3232c0735928905ed to your computer and use it in GitHub Desktop.
Remove a git commit and re-push corrections
// If a push to the remote origin was already done then do the following
1. git stash // in same directory as previous commit
2. git reset --hard HEAD~1 // reset to the commit before last
3. git stash apply
4. Build if necessary and test
5. Commit whatever is needed
6. git push origin HEAD --force
7. Done
8. Have cake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment