Hello,
I would like to fetch the pull request from my Bitbucket project (private repository) to my local git repository to be able to do some tests before merge etc.
So I have tried (according to docs and this QA forum) this request:
$ git fetch origin pull/3/head
However - what can I do when I get those messages:
fatal: Couldn't find remote ref pull/3/head fatal: The remote end hung up unexpectedly
This feature is not supported at this time. It would be reasonable to compare the branches using this suggestion: http://stackoverflow.com/questions/822811/showing-which-files-have-changed-between-git-branches
Hello, thanks a lot for your answer. Yes, I am able to diff the branches; however it is quite strange for more complicated pull requests and bigger projects from my point of view.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey there, I've made a feature request: https://bitbucket.org/site/master/issue/10263/as-a-user-i-would-like-to-be-able-to-fetch
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The following worked for me, for checking out a pull request locally:
git fetch origin refs/pull-requests/<pull request number>/from:<new local branch name>
From there, you can do tests, merge this branch into another branch, etc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Exactly what I needed. Just checkout the new local branch and voila
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not working for me, I see this error:
$ git fetch origin refs/pull-requests/1/from:test
fatal: Couldn't find remote ref refs/pull-requests/1/from
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For me also not working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
git config remote.origin.url https://xxx.com/repo.git
git branch repo_pr
git fetch origin refs/pull-requests/1/from:repo_pr
git checkout repo_pr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Guys, any update on this? None of the answers worked for me :(
Getting same error as @Chi Fung Wong
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I made this workaround in our build pipeline, it queries the api which triggers the ref creation (same happens if you go to the diff page of the PR).
1. curl --request GET --url $PATH_TO_PR_DIFF > /dev/null
2. git fetch origin refs/pull-requests/PR_NUMBER/from
This works for me on bitbucket datacenter server 7.1.3., api documentation: https://docs.atlassian.com/bitbucket-server/rest/7.1.3/bitbucket-rest.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for this!
I still need to figure out how to get it into our pipeline, but it at least helps explain why our pull requests fail their builds.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is working for me with BitBucket Server v6.4.1
git fetch origin +refs/pull-requests/*/from:refs/remotes/origin/pull-requests/*
Then `git branch -a` shows the branch available to checkout.
Credit to Örjan Sjöholm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
$ git fetch origin +refs/pull-requests/4/from:refs/remotes/origin/pull-requests/4
fatal: couldn't find remote ref refs/pull-requests/4/from
fatal: The remote end hung up unexpectedly
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With Bitbucket Cloud this cannot (currently) be done.
Are you using Bitbucket Cloud (ie bitbucket.org) or Bitbucket Server?
To confirm this for yourself, run `git ls-remote` against a repo with open pull requests. If you have open pull requests and do not see entries for refs/pull-requests or similar in the output from git ls-remote then there are no pull request refs exposed for you to clone.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What a bummer!!! Why would I use a web interface when I can do it locally??? :-(
Does GitHub support it?
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.