develooper Front page | perl.perl5.porters | Postings from January 2009

understanding merge history

Thread Next
Dave Mitchell
January 27, 2009 14:39
understanding merge history
Message ID:
To any git-head out there...

I'm trying to get my head around some of the implications for history
and maint, given git's more liberal approach to branching and merging.

ie in the good ol' Perforce days, the bleed track was a nice simple linear

    A -> B -> C -> D etc

So, when we updated the Changes file, we would just prepend A,B,C,D to it.
Similarly, the job of the maint pumpking was to go through the list A, B,
C and D, and for each, decide whether to reject, apply, or partially apply.

In the exciting new world of Git, we no longer have a simple linear commit
history; at the very minimum there are likely to be lots of diamond
formations, eg

            C1 -> C2 -> C3
          /               \ 
    A -> B                  E -> F
          \               /
            D1 -> D2 ----/

Where the C's may have been in the bleed branch, and the D's in the y2038k
branch, for example.

So, some questions:

For a merge commit, is there any concept that parent 1 (in the sense of
git cherry-pick -m 1) is always the 'main' parent - ie always following
parent 1 will give us a list of of all changes that went into the bleed
branch rather than all the other temporary branches? ie would it give us:

    A -> B -> C1 -> C2 -> C3 ->  E -> F

Following on from that, how does git log handle this - ie what subsets of
C* and D* does it display, and in what order? Any why?

Now suppose I want to cherry-pick E for maint. It seems to be that
if I want all of the branch (ie both D1, and D2), then I just do
cherry-pick -m 1 and it applies the diff between C3 and E to maint (ie one
big commit containing D1 and D2).

This seems ok as long as the D branch is small and I want all of it.
However, what happens if I only want some of the Ds added to maint?
Or if I want all the D's, but as individual commits (for better bisecting
when things go wrong, for example)?

Confused of Sheffield.

Dave's first rule of Opera:
If something needs saying, say it: don't warble it.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About