Reputation: 22490
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?
Upvotes: 15
Views: 23550
Reputation: 22490
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 checkout -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
Upvotes: 9
Reputation: 142612
Yes you can but in a workaround:
Add the 2 remotes to your repository. then do a git cherry-pick
of the desired commit to the second repository and now create a new pull request as usual.
The point is that in GIT you can have multiple remotes and the commits can be "added" to any of the branches.
If you work with github the pull request are fetched locally to your repository so you can merge them right away.
https://gist.github.com/piscisaureus/3342247
Upvotes: 2
Reputation: 126747
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
Upvotes: 3