Reputation: 799
I have four branches:
Dev 1 is working into Branch 1, Dev 2 is working in Branch 2, and Dev 3 is working in Branch 3.
Now I need to pull the changes of Branch 1 into Branch 3, not merge. So that in future Dev 1 continue to work on Branch 1 and Dev 3 has all codes from Dev 1 as well as Branch 3.
How can we do this?
Upvotes: 0
Views: 443
Reputation: 1931
That is probably a bad thing to do. I would personally merge in from the branch I want changes from. From my understanding you’re looking for cherry-pick:
git cherry-pick commit
Upvotes: 0
Reputation: 535988
Now I need to pull the changes of Branch 1 into Branch 3, not merge. So that in future Dev 1 continue to work on Branch 1 and Dev 3 has all codes from Dev 1 as well as Branch 3
You can't. Changes in one branch do not magically percolate live into another branch.
You can make it so that branch 3 acquires all the "changes" that are in branch 1 now. That is what a merge is, or a rebase. But you can not make it so that future changes in branch 1 somehow pass thru a wormhole and simply appear in branch 3 on dev 3's machine. The only way to make that happen is for dev 3 to acquire the "changes" from branch 1 again.
And that is not an unreasonable thing to do. When I'm working on a feature, I pull develop
and rebase my branch onto it, every hour or so. So that way, I always have the latest "changes" from develop
. But not because of magic. Because of me.
Upvotes: 0
Reputation: 695
You can take pull of Branch 1 in Branch 3 then all changes form Branch 1 will be in Branch 3
git checkout Branch 3
git pull origin Branch 1
Upvotes: 1