Re: Have git-merge-base support multiple IDs

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

 



Jan Engelhardt venit, vidit, dixit 03.08.2009 15:39:
> 
> On Friday 2009-07-31 18:22, Michael J Gruber wrote:
>> Jan Engelhardt venit, vidit, dixit 31.07.2009 17:51:
>>> To determine the rebase point (i.e. first commit in a series),
>>> one can (ab)use git-merge-base:
>>>
>>>   p=$(git merge-base ab80794f faae2553)
>>>   git re -i ${p}^
>>>
>>> The twist is that merge-base in git 1.6.3.3 happens to ignore any 
>>> further arguments following two IDs. In short:
>>>
>>>   git merge-base A B C...
>>>
>>> Only yields the merge-base of A and B, and ignores C...
>>
>> Uhm, are you sure about this?
>> The first argument is special. merge-base computes the merge base between two commits:
>> - the first argument
>> - a (hypothetical) merge between all other arguments.
>> It may look a if C was ignored, though.
> 
> Hm indeed. Is there a better way to find the common ancestor of commits?

I haven't tested thorougly, but at least for the standard example

git show-branch --merge-base A B C

seems to do what you want. Note that for this command, the order of
arguments is irrelevant, whereas for git merge-base it makes a huge
difference. Also, git show-branch documentation is a bit outdated. I
expect to look into this...

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