Reputation: 28901
I have a private repository in BitBucket.
A team member has read access to this repository and has made a pull request to the main repository.
I want to be able to fetch this repo, so I can see the changes on my computer, without merging those changes yet.
After some time on Google I found:
It says to hover over the new repo and the URL is shown below. However, the URL does not show on my browser. UPDATE: Note that I do not have any permissions to access this repository directly!
Therefore, my question is how can I fetch a repository from a pull request without merging it to my main repo.
Info in how to do this in SourceTree GUI will also be helpful.
Update
Note that git ls-remote origin
gives output similar to the following:
$ git ls-remote origin
35xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2d HEAD
35xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2d refs/heads/master
36xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/tags/v1.0.0.0
bdxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/tags/v2.2.0.0
49xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/tags/v2.2.0.0^{}
Upvotes: 2
Views: 3409
Reputation: 1037
git fetch origin pull/$PR_No/head:$Local_branch
Then;
git checkout $Local_branch
to view the remote Pull Request without merging.
Upvotes: 1
Reputation: 94716
You can try
git fetch origin refs/pull-requests/$PR_NO/from:$LOCAL_BRANCH
but there is an open issue that states it's impossible to do what you want.
Found at https://stackoverflow.com/a/40948201/7976758. Recommendation there is to download patch for the PR and apply at manually.
Upvotes: 3
Reputation: 30277
Once you can see that branch from your local (by adding a remote, probably) you can checkout that remote branch so you can see if the code is working fine and so on and decide to merge it or not. If you don't like it, then just go back to whatever branch you were on before.
git checkout some-remote/some-branch
Upvotes: -1