Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

move git pull requests from bitbucket to github?

My client was using Bitbucket for his git repo, I made a lot of work, created many pull requests in it, but recently he moved his repo to Github without my pull requests.

How I can move pull requests to copied Github repo?

I saw that post: How to move git repository with all branches from bitbucket to github?, but over there they discuss moving the repo itself with everything else, but in my case I just need to move pull requests only.

like image 272
Renat Gatin Avatar asked Sep 16 '15 21:09

Renat Gatin


People also ask

How do I withdraw a pull request in Bitbucket?

Declining a pull request can't be undone. Once you decline a pull request, you'll have to open a new pull request request to review code for the same branch.

How do I move a pull request to another branch?

In the "Pull Requests" list, click the pull request you'd like to modify. Next to the pull request's title, click Edit. In the base branch drop-down menu, select the base branch you'd like to compare changes against. Read the information about changing the base branch and click Change base.


1 Answers

One simple option is to:

  • fork that new GitHub repo into your own account
  • clone that fork (that you own)
  • add as a git remote a reference to the BitBucket repo (which might have a different history, different sha1)

    git remote add bitbucket https://bitbucket.org/account/repo
    git fetch bitbucket
    
  • create a local branch (git checkout -b mypatch)

  • cherry-pick the commits of the bitbucket/yourBranch (with yourBranch being the branch where you were doing patches for your BitBucket pull request).
    That will replay the commits of your BitBucket patch branch onto your new local branch.

  • push that new local branch to your GitHub fork

  • trigger a new pull request from that newly pushed branch.

like image 97
VonC Avatar answered Oct 12 '22 22:10

VonC