Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git move pull request from one repository to another repository

Tags:

git

I have a repository ONE with some work in it. There is a open pull request called pull-request which I would like to move with all commits into another repository called TWO.

Repository "ONE" c1_c2_c3_c4_c10_c11_c12_c13...
                            \
     branch "pull-request"   \_c5_c6_c7_c8_c9



Repository "TWO" _____________________________
                                              \
     branch "pull-request-from-repository-ONE" \_c5_c6_c7_c8_c9

Is this possible? If so how?

like image 239
caramba Avatar asked Apr 19 '16 12:04

caramba


2 Answers

Thanks to Steve Bennetts and CodeWizards answers I could get it to work with a mix of both answers like this:

in Repository TWO

git remote add ONE  https://...
git fetch ONE pull-request

git co -b pull-request-from-repository-ONE
git cherry-pick [sha-commit-hash]

note I messed up with trying to cherry-pick a range of commits, cause my pull-request branch had merges already inside... so anyway, cherry-picking single commits seems to work

like image 62
caramba Avatar answered Sep 21 '22 09:09

caramba


Assuming this "pull request" is on a service like Github, you just treat it like any other branch, on your computer:

git remote add repoone https://....
git fetch repoone
git merge pull-request
like image 43
Steve Bennett Avatar answered Sep 20 '22 09:09

Steve Bennett