git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Phil Hord <phil.hord@gmail.com>
Cc: Jon Seymour <jon.seymour@gmail.com>,
	J Robert Ray <jrobertray@gmail.com>,
	Thomas Rast <trast@student.ethz.ch>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: rebase -p loses amended changes
Date: Wed, 04 Apr 2012 08:30:55 +0200	[thread overview]
Message-ID: <4F7BEA9F.3060805@viscovery.net> (raw)
In-Reply-To: <CABURp0pnXvnT2=fDJXk-yiGctsJBHiNGSCOZiT4Vo74woi0Zxg@mail.gmail.com>

Am 4/4/2012 0:09, schrieb Phil Hord:
> On Tue, Apr 3, 2012 at 5:43 PM, Jon Seymour <jon.seymour@gmail.com> wrote:
>> Suppose you have a merge of a A and B that produces M, which is then
>> amended as M'.
>>
>> During rebase, you redo the merge A and B. If there are no conflicts,
>> then compare M with M' to produce D. You now have enough information
>> to reproduce the amended commit M' during a rebase (merge Ar and,Br
>> then apply D).
> 
> How does M' know it is an amended version of M?  When you amended the
> commit M you threw away this linkage.
> 
> If you created M' as a new commit D instead, then I would agree that
> you have enough information to do what you seek.  In fact, I'm pretty
> sure git does this already.

IMO, it is a sub-optimal implementation of rebase -p that it attempts to
redo the merge. A better strategy is to just replay the changes between
the first parent and the merge commit, and then generate a new merge commit:

   git diff-tree -p M^ M | git apply --index &&
   git rev-parse M^2 > .git/MERGE_HEAD &&
   git commit -c M

This would side-step all the issues discussed here, no?

-- Hannes

  reply	other threads:[~2012-04-04  6:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <592E2EEC-6CBA-48D6-8D44-34A971DD78EC@gmail.com>
2012-03-31  5:55 ` rebase -p loses amended changes Jon Seymour
2012-03-31  9:35   ` Thomas Rast
2012-03-31  9:39     ` Jon Seymour
2012-04-03 18:55       ` J Robert Ray
2012-04-03 21:43         ` Jon Seymour
2012-04-03 22:02           ` Junio C Hamano
2012-04-03 22:09           ` Phil Hord
2012-04-04  6:30             ` Johannes Sixt [this message]
2012-04-04 17:11               ` Junio C Hamano
2012-04-04 20:26                 ` Junio C Hamano
2012-04-04 22:55                   ` Jon Seymour
2012-04-04 22:59                     ` Junio C Hamano
2012-04-04 23:05                       ` Jon Seymour
2012-04-04 23:20                         ` Junio C Hamano
2012-04-05 16:16               ` Martin von Zweigbergk
2012-04-05 16:33                 ` Jon Seymour
2012-04-05 16:43                   ` Martin von Zweigbergk
2012-04-10  7:14                 ` Johannes Sixt
2012-03-30 21:31 J Robert Ray
2012-03-30 22:49 ` Thomas Rast

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=4F7BEA9F.3060805@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=jon.seymour@gmail.com \
    --cc=jrobertray@gmail.com \
    --cc=phil.hord@gmail.com \
    --cc=trast@student.ethz.ch \
    /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).