Re: rewrite history

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

 



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.
--
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]