16

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.

Community
  • 1
  • 1
Renat Gatin
  • 6,053
  • 5
  • 37
  • 58

1 Answers1

9

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi, I found this insightful, I am moving to github, wondering if there is an option to save this and run it from _nside_ github, since they now have import repo option directly. Also, this step seems to be the key to having two repo reference in one folder, " _add as a git remote a reference to the BitBucket repo (which might have a different history_ " can you please expand how to do this – Transformer Jan 18 '21 at 20:36