Skip to content

Instantly share code, notes, and snippets.

@thagler
Created September 13, 2016 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thagler/baebf0a870c559093c70335a5992402d to your computer and use it in GitHub Desktop.
Save thagler/baebf0a870c559093c70335a5992402d to your computer and use it in GitHub Desktop.
Remove the latest commit from a branch already pushed to origin
For a list of the most recent commits
`git log --pretty=oneline --abbrev-commit`
Go back 1 commit to remove
`git rebase -i HEAD~1`
replace ‘pick’ with ‘drop’ in that commit line and save (should be in vi)
`git push origin +my/branch-name`
Note: push +branch_name is like --force, but slightly less of a jerk about it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment