I've searched Atlassian docs and found this ref/pull-requests/$PR_NO/from
and when I try to fetch that, I encounter this error Couldn't find remote ref refs/pull-requests/1/from
. Is there a way to enable this ref? Or are webhooks the only option? I am trying a CI setup with Bitbucket.
(We're on the 10-user paid plan)
This is now possible. You just need to add a line like this to your <repo_root>/.git/config
:
[remote "origin"]
url = ...
fetch = ...
fetch = +refs/pull-requests/*:refs/pull-requests/*
When you fetch, you'll see a whole new set of refs appear:
$ git fetch origin
remote: Counting objects: 252, done.
remote: Compressing objects: 100% (48/48), done.
remote: Total 82 (delta 20), reused 0 (delta 0)
Unpacking objects: 100% (82/82), done.
From ...
* [new ref] refs/pull-requests/300/from -> refs/pull-requests/300/from
* [new ref] refs/pull-requests/300/merge -> refs/pull-requests/300/merge
* [new ref] refs/pull-requests/302/from -> refs/pull-requests/302/from
* [new ref] refs/pull-requests/323/from -> refs/pull-requests/323/from
* [new ref] refs/pull-requests/323/merge -> refs/pull-requests/323/merge
* [new ref] refs/pull-requests/344/from -> refs/pull-requests/344/from
* [new ref] refs/pull-requests/344/merge -> refs/pull-requests/344/merge
* [new ref] refs/pull-requests/350/from -> refs/pull-requests/350/from
* [new ref] refs/pull-requests/350/merge -> refs/pull-requests/350/merge
* [new ref] refs/pull-requests/355/from -> refs/pull-requests/355/from
* [new ref] refs/pull-requests/355/merge -> refs/pull-requests/355/merge
*/from
gives you PR branch heads; */merge
gives you the result of merging the PR with your target branch.
For more details, see Pull request proficiency: Fetching abilities unlocked!
This is unsupported by Bitbucket: https://bitbucket.org/site/master/issues/5814/reify-pull-requests-by-making-them-a-ref
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With