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

Re: What should I do to display the diff of even a simple merge commit?

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 10, 2010, 00:05 UTC
Message-ID
<7v1vguuf8h.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20100209235707.GQ9553@machine.or.cz>
Petr Baudis <pasky@suse.cz> writes:
Show 12 quoted lines
>   I'm not sure if there is any clever switch for this, but I usually
> just use one of
>
> 	git diff mergecommit^1 mergecommit
> 	git diff mergecommit^2 mergecommit
>
> depending on which parent I want the diff against. If you always do your
> merges as "on mainline, merging in a topic" without fast-forwarding,
> diff against the first parent will be probably the right one and you can
> simply use:
>
> 	git diff mergecommit^ mergecommit
Frankly, we should make "git log --first-parent -p" DTRT, I think.

The attitude towards merges we maintain officially is "all parents are equal", but in practice, there often are cases where --first-parent traversal makes a lot more sense when browsing the history (especially "the official" one). The use of that option should be a clear enough sign that diff between the first parent and the merge result is asked for.

Previous: Petr BaudisNext: Petr Baudis
Message 4 of 9 in “What should I do to display the diff of even a simple merge commit?”
  1. Christian MICHONFeb 9, 2010
  2. Christian MICHONFeb 9, 2010
  3. Petr BaudisFeb 9, 2010
  4. Junio C HamanoFeb 10, 2010
  5. git log -p -m: Document, honor --first-parentPetr Baudis, Feb 10, 2010
  6. Junio C HamanoFeb 10, 2010
  7. Petr BaudisFeb 10, 2010
  8. Junio C HamanoFeb 10, 2010
  9. Christian MICHONFeb 10, 2010

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.