Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I handle a pull request in BitBucket which requires some tweaks?

Someone has sent me a pull request on BitBucket. The change in question is submitted on the default branch. Before I merge it in, I'd like to make a couple of tweaks, but more importantly, I'd like to publish a preview build of this change, for the community to evaluate it and see if they're happy.

Ideally I would like to pull the change into the main repo, but put it on a branch. Make a couple of tweaks. Tag it like I would any other build, and publish. However, it doesn't seem like this is possible: if I understand correctly, the branch is "baked in" and I can't pull the change onto a different branch. Is this correct?

If so, what can I do instead? I could pull and then merge the second head into oblivion, while also creating a branch off the change I pulled. Or I could do the work on a fork, but this would mean that there will be no tag associated with this build in the main repo. Or should I do something else altogether?

P.S. The change itself is high quality and this is not about asking the original author to improve it.

like image 626
Roman Starkov Avatar asked Mar 06 '13 20:03

Roman Starkov


2 Answers

Rather than using the Bitbucket 'accept pull request' just pull the changes into your local repo. You can use rebase to move the commit (or set of commits) on to a named branch. Then just push the changes you main bitbucket repo. (and possible reject the bibucket pull request with a comment saying the changes have been push to the main repo)

For example:

if you repo is: bitbucket/ProjectA/MainRepoForProjectA

and the pullrequest is from: bitbucket/someuser/MainRepoForProjectA

  1. pull from bitbucket/someuser/MainRepoMainRepoForProjectA
  2. rebase to newly pulled commits to named branch.
  3. Make any extra changes you want to make.
  4. push to bitbucket/ProjectA/MainRepoMainRepoForProjectA

Note: If you haven't used rebase before then:

  1. Enable it in TortoiseHg File -> Settings -> Extensions
  2. Update to the head of branch you want to move the the changes too.
  3. Right click on the base of the changes you to move -> Modify History -> Rebase
like image 184
Tom Avatar answered Oct 05 '22 11:10

Tom


This may be helpful:

http://www.electricmonk.nl/log/2014/03/31/test-a-pull-merge-request-before-accepting-on-bitbucket/

Basically, the link says to do the following:

  • git fetch https://bitbucket.org/myrepository/master somename
  • git checkout FETCH_HEAD
  • inspect code and test to heart's content.
  • (if code is accepted), git checkout master
  • git merge FETCH_HEAD
  • git push
like image 33
Ardee Aram Avatar answered Oct 05 '22 11:10

Ardee Aram