Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to checkout a forked pull request locally in SourceTree?

Sometimes pull requests are quite complex and/or potentially bug-ridden. In that case it can be a little unreasonable to spot check a pull request solely by reading the code. It makes more sense to checkout, pull, and build that pull request locally first before merging it. In this manner a repo maintainer can have more confidence that the pull request didn't introduce any regression issues.

enter image description here

I can checkout a pull request from the command-line fairly easily, but I would prefer to use SourceTree. I know using the command-line is simple and straightforward, but I believe in using GUI tools whenever possible over command-line tools. SourceTree has become the de facto standard gui git client for windows, so it seems like SourceTree would have this basic functionality. However, I tried a number of different commands and dialogs and I can't seem to get access to the pull request inside SourceTree.

Can a pull request be pulled locally just using SourceTree? How?

like image 785
Mark Rogers Avatar asked Aug 07 '16 15:08

Mark Rogers


1 Answers

I found that Abhishek's answer works just fine!

Here is how i did:

  • Go to the repositories ".git"-folder and open config-file
  • On the "[remote "origin"]-entry, change fetch to: fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
  • Close the repo-tab in SourceTree and open it again.
  • Click on "Fetch" in the toolbar to fetch all PR-branches.

No the PRs is shown as branches:

enter image description here

like image 182
Markus Knappen Johansson Avatar answered Oct 08 '22 05:10

Markus Knappen Johansson