Skip to content

Instantly share code, notes, and snippets.

@enimiste
Created October 6, 2025 08:01
Show Gist options
  • Select an option

  • Save enimiste/82cfa244d724c01aae3a91906ed7fe47 to your computer and use it in GitHub Desktop.

Select an option

Save enimiste/82cfa244d724c01aae3a91906ed7fe47 to your computer and use it in GitHub Desktop.
How to update a pull request ?

How to update a pull request ?

you don't need hub to update pull requests. Pull requests are tied to the remote branch they're opened from (the pull-request "head"). Just push to that branch again and GitHub will automatically figure it out. You can even force-push, of you need that.

What if you accidentally have removed the remote branch that is linked to the PR? Is it possible to fetch the PR and link it to a new remote on your fork, so the PR can be updated? Asking for a friend...

So to update a PR, even if you have removed the original remote branch out of which the PR was created, you just need to:

  • Fetch the PR (git fetch pull//head:branchname and git checkout branchname).
  • Add new commits, amend, rebase, do whatever you like.
  • Push or push force (git push remote +branch).

And after that the PR will be automagically updated :)

Source : mislav/hub#198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment