A project on GitHub that I have a fork of has a new pull requests that I want to pull into my fork that the author has not pulled in yet.
Is there a simple way to apply pull request from other forks into my fork? Is there something else here that I am missing?
GitHub has now introduced a feature to sync a fork with the click of a button. Go to your fork, click on Fetch upstream , and then click on Fetch and merge to directly sync your fork with its parent repo. You may also click on the Compare button to compare the changes before merging.
You just need to fetch the list of commits from the other repository and then merge his branch into your tree. Merging should do the right thing with your commits on both branches.
You can also do this via the github webpage.
I assume, you should have already a fork (MyFork
) of the common repo (BaseRepo
) which has the pending pull request from a fork (OtherFork
) you are interested in.
OtherFork
) which has initiated the pull request which you like to get into your fork (MyFork
)OtherFork
OtherFork
branch too. Select on the left side as the base fork your fork (MyFork
) (IMPORTANT).View pull request
should change to Create pull request
. Click this.Now you should have a pending pull request in your fork (MyFork
), which you can simply accept.
You can do it manually quite easily:
add the other fork as a remote of your repo:
git remote add otherfork git://github.com/request-author/project.git
fetch his repo's commits
git fetch otherfork
You have then two options to apply the pull request (if you don't want to choose pick 1.)
If you don't care about applying also the eventual commits that have been added between the origin and the pull request, you can just rebase the branch on which the pull request was formed
git rebase master otherfork/pullrequest-branch
If you only want the commits in the pull request, identify their SHA1 and do
git cherry-pick <first-SHA1> <second-SHA1> <etc.>
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