How to pull a single changeset from a child branch into a parent branch?
I have a linux-2.6 repo with two branches off of 2.6.13.
One branch (ben_v13) has just my own changes.
A second branch (work_v13) has the 2.6.13.5 patch, and I've also pulled ben_v13 into it.
Now, I made a small change to work_v13, and I'd like to pull only that changeset into ben_v13. Is there a way to do that w/out having to export and apply a patch?
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 5 lines · Ben Greear
I have a linux-2.6 repo with two branches off of 2.6.13.
One branch (
ben_v13) has just my own changes.
A second branch (work_v13) has the 2.6.13.5 patch, and I've also pulledben_v13into it.
"2.6.13.5"
o---o---o---o
/ \ "work_v13"
---o "2.6.13" .---*
\ /
o---o---o
"ben_v13"
'o' are commits, '*' is a merge.Quoted 1 line
Now, I made a small change to
work_v13,
"2.6.13.5"
o---o---o---o
/ \ "work_v13"
---o "2.6.13" .---*---x
\ / (new change)
o---o---o
"ben_v13"Quoted 3 lines
... and I'd like to pull only
that changeset intoben_v13. Is there a way to do that w/out having to export and apply a patch?
I would have done things differently.
It is generally a good idea if a change is applicable to more than one branches, and these branches have merge relationship between them (work_v13 merges from ben_v13, which has already happened), then to apply that change to the oldest branch and pull the branch to the new one. In other words, if you made the change to 2.6.13 based one, you could have pulled that into 2.6.13.5 based one.
"2.6.13.5"
o---o---o---o
/ \ "work_v13"
---o "2.6.13" .---*
\ /
o---o---o---x
"ben_v13"
(new change)
[Commit what is applicable to both in older branch]
"2.6.13.5"
o---o---o---o
/ \ "work_v13"
---o "2.6.13" .---*--*
\ / /
o---o---o---x---'
"ben_v13"
(new change)
[And then merge that to the derived one]Assuming that correcting the situation like this is not an option, you could check "git cherry-pick". It lets you create something like this:
"2.6.13.5"
o---o---o---o
/ \ "work_v13"
---o "2.6.13" .---*---x
\ /
o---o---o---------x'
"ben_v13" (equivalent of 'x' commit)The command sequence to do this is:
$ git checkout ben_v13
$ git cherry-pick work_v13Quoted 33 lines · Junio C Hamano
Quoted 5 lines · Ben Greear
I have a linux-2.6 repo with two branches off of 2.6.13.
One branch (
ben_v13) has just my own changes.
A second branch (work_v13) has the 2.6.13.5 patch, and I've also pulledben_v13into it."2.6.13.5" o---o---o---o / \ "work_v13" ---o "2.6.13" .---* \ / o---o---o "ben_v13" 'o' are commits, '*' is a merge.Quoted 1 line
Now, I made a small change to
work_v13,"2.6.13.5" o---o---o---o / \ "work_v13" ---o "2.6.13" .---*---x \ / (new change) o---o---o "ben_v13"
Quoted 6 lines
Quoted 3 lines
... and I'd like to pull only
that changeset intoben_v13. Is there a way to do that w/out having to export and apply a patch?I would have done things differently.
Yeah, the main problem is that I test in the combined tree and forgot to change to the ben_v13 tree before making my changes...
I'll try out the cherry-pick option..and if that doesn't work, I'll just manually patch the changes into the ben_v13 tree.
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com