Skip to content

Instantly share code, notes, and snippets.

@brandur
Last active January 3, 2022 16:07
Show Gist options
  • Save brandur/10914112 to your computer and use it in GitHub Desktop.
Save brandur/10914112 to your computer and use it in GitHub Desktop.
Force pull request's diff to reset itself against target branch

Force pull request's diff to reset itself against target branch

git checkout feature-branch
# empty commit; don't worry, this will not show up in the final pull
git commit --allow-empty -m "Empty commit"
git push origin feature-branch
# hard reset to before empty commit
git reset --hard HEAD~
git push -f origin feature-branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment