git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Howto get the merge-base ?

From
Junio C Hamano <junkio@cox.net>
Date
May 14, 2006, 18:12 UTC
Message-ID
<7vu07s1nn3.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<4fb292fa0605141104j6c73c1eao5a8eeea9ad1b6282@mail.gmail.com>
"Bertrand Jacquin" <beber.mailing@gmail.com> writes:
Show 24 quoted lines
> On 5/14/06, Junio C Hamano <junkio@cox.net> wrote:
>> "Bertrand Jacquin" <beber.mailing@gmail.com> writes:
>>
>> > I'm trying to know which commit it the parent of a merge.
>> > For exemple if I do that :
>> >
>> >   o Merge
>> >  / \
>> > /   \
>> > |   |
>> > |   o Commit D
>> > |   |
>> > |   o Commit C
>> > |   |
>> > o   | Commit B
>> > \  /
>> >  \/
>> >  o Commit A
>> >  |
>> >  o Init
>> >
> No, that's just on the following of git-send-mail-commit.sh thread (or
> something near). To make a readable merge mail with diffstat and
> summury.

For that you do not want merge-base. If your mainline was A-B and you merged a side branch B-C-D with the merge, then to people who tracked your head (that's the audience of "merge mail", I presume) they just need to see:

	git diff --stat M^1..M
	git rev-list --no-merges --pretty M^1..M | git shortlog

The diffstat is "what damage was inflicted on the branch you have been following with this merge", so the diff between the trees before and after the merge is what you want. And the rev-list piped to shortlog is to show "what commits were _not_ present on this branch before the merge, but are present after the merge" (it could be spelled M^1..M^2 but the above would handle octopus as well).

Previous: Bertrand JacquinNext: Linus Torvalds
Message 4 of 5 in “Howto get the merge-base ?”
  1. Bertrand JacquinMay 14, 2006
  2. Junio C HamanoMay 14, 2006
  3. Bertrand JacquinMay 14, 2006
  4. Junio C HamanoMay 14, 2006
  5. Linus TorvaldsMay 14, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.