Skip to content

Instantly share code, notes, and snippets.

@tomgross
Last active February 28, 2024 10:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tomgross/4362329ef99acc54bc774b7b37650911 to your computer and use it in GitHub Desktop.
Save tomgross/4362329ef99acc54bc774b7b37650911 to your computer and use it in GitHub Desktop.
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