How to checkout a forked pull request locally in SourceTree?

1 answer

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.

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.

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 Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

274 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot