All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Basin <basinilya@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re[2]: rewrite history
Date: Fri, 17 Jun 2011 00:06:44 +0400	[thread overview]
Message-ID: <17721660.20110617000644@gmail.com> (raw)
In-Reply-To: <20110616194911.GA14355@sigill.intra.peff.net>

JK> On Thu, Jun 16, 2011 at 12:43:00PM -0700, Junio C Hamano wrote:

>> >> Hi list. There were 2 branches. One's HEAD was modified to match a
>> >> specific commit at another branch. Now, how to merge them according to
>> >> this scheme?
>> >> 
>> >> A---B---X---E---F
>> >>                      =>  C---D---X---E---F
>> >> C---D---X'
>> >> 
>> >> X and X' have no difference. I tried to write a script to cherry-pick
>> >> E and F, but some of commits are merges and cherry-pick fails.
>> >
>> > I think you just want to rebase using the "-p" option to preserve
>> > merges. Something like:
>> >
>> >   $ git checkout -b rebased-branch F
>> >   $ git rebase -p --onto D B
>> >
>> > that will pick X, E, and F, and replay them on top of D, resulting in
>> > the graph you showed above.
>> 
>> Eh, careful. Nobody said the change between B and X is any similar to the
>> change between D and X'. Replaying the changes E and F introduce on top of
>> X' to arrive at C--D--X'-E--F is the best you could do, i.e.

JK> I thought that was exactly what Ilya said with "X and X' have no
JK> difference". I assumed that meant "they are semantically similar commits
JK> on different bases" (i.e., a cherry-pick) and not "they have the exact
JK> same tree state" (i.e., "git diff X X'" is empty).

>> But wouldn't filter-branch a better tool for this?  Graft to pretend that
>> the parent of X is D instead of B, and filter the branch with F at its
>> tip, that is.

JK> If my assumption on the meanings is reversed (i.e., X and X' really are
JK> the same tree state, not introducing equivalent commits), then yeah,
JK> that would be better.

JK> -Peff

sorry,
git diff X X' is empty


-- 

  reply	other threads:[~2011-06-16 20:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-16 19:17 rewrite history Ilya Basin
2011-06-16 19:26 ` Jeff King
2011-06-16 19:43   ` Junio C Hamano
2011-06-16 19:49     ` Jeff King
2011-06-16 20:06       ` Ilya Basin [this message]
2011-06-16 20:13         ` Jeff King
2011-06-16 21:55           ` Re[2]: " Ilya Basin
2011-06-16 22:18             ` Re[3]: " Ilya Basin
2011-06-16 21:33 ` Marc Branchaud

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=17721660.20110617000644@gmail.com \
    --to=basinilya@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.