git - How does one change a range of commits to have happened on another branch? -
My impression is that the solution is simple, but I can not find an example that clearly resolves my problem I do get guidance on the following:
I currently have a history:
a - - - c - - - - - f master \ \ B - - - d - e - - - g - h topic
d
, e
, g
, And h
must all be done on master
. At this point only the difference should be B
then it should look like:
a - - - c - d - e - f - g - h master b topic
or better yet:
A - C - D - E - F - G - H Master \ b topic
... but I do not know how to be completed
It does not seem that I have written D
, e
Can I merge into live
, and . H
all ends at I b
with master
.
I believe that I can raise them cherries, but it seems that to present future problems, what is the best solution?
If you are pushing these branches in any remote repo, this is not a good past history If you have pushed, then I would like to avoid writing again by doing this:
-
Master
'sF > Master
.- Cherry-selected
D
,e
,g
andh
- Cherry-selected
- Merge with checkout
subject
andmaster
.
If you do this, then you have: -> -> -> -> -> -> -> - - - - - - D '- E' - G ' - - - - - - - - - Topic -
History will not look super-clean, but you will have code for every code.
If you really want to re-write the history because it's just local for you or you do not care to mess with others who can pull from your repo: / P>
- Roll the master back to
C
(Note the hash before> F
.). - Cherry-pick
D
,e
,F
,g
andHK
onMaster
. - Branch
Topic2
toMaster
'sh
head. - The cherry-pick
b
attopic2
. Change the
topic
from topic
, topic 2
And you get:
A - C - D - E - F - G - H Master B topic
Comments
Post a Comment