How to checkout (on a forked repo) a Pull Request coming from the main repo?
11 November 2017 · 2 minutes to read
By reading the related question on StackOverflow, you can get a very first understanding of today’s topic.
As I mentioned in an earlier post, I am using flexible-jekyll for this blog, which implies that I am working on the forked version of the main project from artemsheludko. So, I have opened an issue on the main project, regarding the possibilities of having post thumbnails for twitter, facebook, etc., which by the way, I find really important. kentonh opened a pull request which seemed to resolve this issue, so I really wanted to test this locally, because I couldn’t wait for at all 😋 🔜
First, we check what we currently have:
We then have to add a new entry to map the parent project from Artem:
We should be good to go now:
Of course NOT! Till now, what we have been doing, was only about managing branches. In order to be able to checkout a Pull Request, we have to add the following line, in our .git/config :
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
So, after that my upstream reference looks like this:
I should now be able to finally fetch the PR, right?
Yes, we got it!!! We should be able to check it out using this git command:
git checkout origin/pr/11
3. Closing Quote
If it hurts, do it more often.