Skip to content

Instantly share code, notes, and snippets.

@marcysutton marcysutton/merging.md
Last active Nov 29, 2016

Embed
What would you like to do?
Bitbucket merge hell

Merging a pull request

To apply a pull request, make sure your local develop branch is up to date. Then, create a new branch for that pull request:

git checkout -b some-user-feature

Run the following commands to apply all commits from that pull request on top of your branch's local history:

Bitbucket

curl -L https://bitbucket.org/api/2.0/repositories/dmusser/axe-core/pullrequests/85/patch | git am -3

Note: the above URL is behind authentication. And that seems to be the issue.

Github

curl -L https://github.com/dequelabs/axe-core/pull/205.patch | git am -3

In the Github UI, you can use the new Squash and Merge feature as an alternative.

If the merge succeeds, use git diff origin/develop to review all the changes that will happen post-merge.

@marcysutton

This comment has been minimized.

Copy link
Owner Author

marcysutton commented Nov 23, 2016

Bitbucket no worky. WHYYY
curl -L https://bitbucket.org/api/2.0/repositories/dmusser/axe-core/pullrequests/85/patch | git am -3

Does not work with or without git am. CURL is Forbidden at that URL. Here is the git-am response:

02:21 PM /Deque/bb-axe-webdriverjs (merge-configure $)> curl -L https://bitbucket.org/api/2.0/repositories/deque/axe-webdriverjs/pull-requests/9/patch | git am -3
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   243  100   243    0     0    448      0 --:--:-- --:--:-- --:--:--   449
Patch is empty. Was it split wrong?
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Documentation link: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests/%7Bpull_request_id%7D/patch

@marcysutton

This comment has been minimized.

Copy link
Owner Author

marcysutton commented Nov 28, 2016

curl https://api.bitbucket.org/2.0/repositories/dmusser/axe-webdriverjs/pullrequests/9/patch
Forbidden

@marcysutton

This comment has been minimized.

Copy link
Owner Author

marcysutton commented Nov 29, 2016

curl -L -u user:app-password https://bitbucket.org/api/2.0/repositories/dmusser/axe-webdriverjs/pullrequests/9/patch | git am -3
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
@seancurtis

This comment has been minimized.

Copy link

seancurtis commented Nov 29, 2016

I think the URL is wrong. I tried this and got the patch for a repo of mine (note api.bitbucket.org/2.0 instead of bitbucket.org/api/2.0 )

curl -L -u username:password https://api.bitbucket.org/2.0/repositories/dmusser/axe-core/pullrequests/85/patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.