git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Jon Seymour <jon.seymour@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: RFD: best way to automatically rewrite a git DAG as a linear history?
Date: Thu, 18 Feb 2010 00:11:29 -0500	[thread overview]
Message-ID: <20100218051129.GD10970@coredump.intra.peff.net> (raw)
In-Reply-To: <2cfc40321002171835j107d2cdcr5f7667d769bf391e@mail.gmail.com>

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

  reply	other threads:[~2010-02-18  5:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-18  2:35 RFD: best way to automatically rewrite a git DAG as a linear history? Jon Seymour
2010-02-18  5:11 ` Jeff King [this message]
2010-02-18 18:38   ` Avery Pennarun
2010-02-19  1:04   ` Jon Seymour
2010-02-19  3:13     ` Avery Pennarun
2010-02-19  7:29       ` Jon Seymour
2010-02-19 20:20         ` Avery Pennarun
2010-02-20  2:25           ` Jon Seymour
2010-02-20  3:05             ` Avery Pennarun
2010-02-21 23:04               ` Jon Seymour
2010-02-21 23:18                 ` Jon Seymour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100218051129.GD10970@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jon.seymour@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).