How do I fetch a pull request in Bitbucket?
In github it's possible to do this with:
git fetch origin pull/1/head
Based on this I tried with:
git fetch origin pull-requests/1/head
But it says:
fatal: Couldn't find remote ref pull-requests/4/head
Thanks in advance!
If you want to check out the code that is part of the pull request, all you have to do is
git checkout -t origin/<source branch>
This will create a local copy of the source branch. Note that you may have to do a git fetch first if you do not see the branch when you do git branch -r
The thing is, the code is not from a branch of the main repo it's from a fork
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay, in that case you need to know the fork URL and you can then use git fetch <forked_repo_url> <branch> to fetch it. Check out How to locally fetch and checkout a pull request
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK thanks, it works
But would be great to have a github-like reference to the pull requests
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, There is another gotcha with this solution, if the project/repository is private, whenever someone fork it it will be private too and if I try to fetch a branch from a private repo of another user I get a 'remote: Unauthorized' error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To finally work with this the user has to explicitly give permissions to those who want to clone/fetch a PR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.