git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Branchaud <marcnarc@xiplink.com>
To: Ilya Basin <basinilya@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: rewrite history
Date: Thu, 16 Jun 2011 17:33:42 -0400	[thread overview]
Message-ID: <4DFA76B6.5030407@xiplink.com> (raw)
In-Reply-To: <362053118.20110616231758@gmail.com>

On 11-06-16 03:17 PM, Ilya Basin 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.
> 
> ...
> 
> git diff X X' is empty

It sounds like you really want to apply X--E--F on top of D, but I don't know
how you can do that since you need to do *something* to D in order to get a
tree that matches X, and that something is (presumably) *different* from the
change that X applied to B.  So if

	diff B X  !=  diff D X'

then I think Junio's right that the best you can do is change the meta-data
in X' (commit message, Author, etc) to match X then apply E and F on top of
that.  But filter-branch seems like overkill to me here -- I'd just use
"rebase -p" but not quite as Peff described:

	git checkout X'
	git commit --amend ....   # Replaces X' with X"
	git rebase -p --onto HEAD X F

Giving you

	C---D---X"---E---F

where

	diff D X'  ==   diff D X"
and	meta_data(X") == meta_data(X)

But if you're happy with C---D---X'---E---F then you can skip the "git commit
--amend" step.

		M.

      parent reply	other threads:[~2011-06-16 21:33 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       ` Re[2]: " Ilya Basin
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 [this message]

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=4DFA76B6.5030407@xiplink.com \
    --to=marcnarc@xiplink.com \
    --cc=basinilya@gmail.com \
    --cc=git@vger.kernel.org \
    /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).