How to checkout a forked pull request locally in SourceTree?

Mark Rogers August 7, 2016

From How to checkout a pull request locally in SourceTree?

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

1 answer

0 votes
Jeff
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 7, 2016

Is there a reason you cannot just check out the branch that the PR is related to?

I would generally suggest switching to the PR branch, and testing the code there.

 

The PR should be a representation of the changes existing on a branch that are being requested to be merged into another branch (usually master), so checking out the source branch should achieve what you are after.

Mark Rogers August 7, 2016

The pull request was from another user's forked clone of the project repo.  I didn't see any option that would allow me to checkout that branch with SourceTree's checkout dialog.  The pull request branch was not visible.

Jeff
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 7, 2016

You would need to check out a copy of the forked repo's branch in order to do that. Sourcetree is just a view over the top of your local git repositories - so the first step is to get that forked repo.

You can do that by clicking on the source branch within the PR in Bitbucket (clicking the repo name on the left in the screenshot below will do that for you).

Screen Shot 2016-08-07 at 10.41.02 AM.png

 

Then once you are in that branch, there should be a checkout branch option on the left, with a checkout in sourcetree option.

Screen Shot 2016-08-07 at 10.44.02 AM.png

 

This will then let you pull down the contents of the PR for local testing, review and validation. From what I know there is not a way to do this action within sourcetree directly, as sourcetree is used to work with the git repos that you have locally and not to work with PRs or remote repos that you may have access to in Bitbucket or Github.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events