I have forked a repo in github. There are some new pull requests in the Upstream
. I want to pull a pull request from upstream locally.
How can I do that? I have no idea and found nothing related to this.
You should be able to do this by first adding the upstream as remote, and then pulling the pull request:
git remote add upstream https://github.com/USER/repository.git
git pull upstream pull/ID/head:BRANCHNAME
git checkout BRANCHNAME
Where USER
is not your username but the original one (the one you forked from), ID
is the pull-request id and BRANCHNAME
will be the local branch name corresponding to the pull-request.
If you want to push to your own fork later, you will likely have to set the upstream (from BRANCHNAME
):
git push -u origin BRANCHNAME
See https://help.github.com/articles/checking-out-pull-requests-locally/:
git fetch origin pull/ID/head:BRANCHNAME
git checkout BRANCHNAME
where ID
is the pull request number and BRANCHNAME
is an arbitrary name for the new local branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With