Re: RFD: best way to automatically rewrite a git DAG as a linear history?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 18, 2010 at 01:35:07PM +1100, Jon Seymour wrote:

> Does the git toolset currently support rewriting a restricted git DAG
> as a linear history in a completely automated way?

Not really. It's a hard problem in the general case. Consider a history
like:

    B
   / \
  A   D
   \ /
    C

That is, two branches fork, each make a commit, and then merge. You want
something like:

  A--B--C'

If there is a merge conflict when making D, then you know that B and C
conflict. In this simple case, you can apply the same conflict
resolution used in D to the creation of C' (in other words, you use the
combined tree state given in D as the tree for C'). But what if C is a
string of commits? Some of the conflict resolution in D will be
applicable to some of the conflicts you will encounter when rebasing C,
but you don't know which.

One simple strategy would be to squash all side-branch development into
a single commit. So you would turn:

    B--C--D
   /       \
  A         H
   \       /
    E--F--G

into

  A--B--C--D--X

where X has the same tree as H, but contains all of the commit messages
of E, F, and G.

You are of course losing quite a bit of information there, but you
haven't really told us what your use case is, so I don't know whether
that's unacceptable or not.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]