Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Recreating a messed up github pull request
# if some commits landed erroneous in a PR on github
# this commands help to start fresh from master
# replace `my_pr_branch` with the name of the branch of your pull request
git checkout my_pr_branch
git diff master > ../pr.patch
git checkout master
git branch -D my_pr_branch
# make sure it is the *SAME* name than the branch you deleted
git checkout -b my_pr_branch
patch -p1 < ../pr.patch
# git add ... if necessary
git commit -a -m "Describe the PR commit"
git push -f --set-upstream origin my_pr_branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment