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

Re: git log omits deleting merges

From
Philip Oakley <philipoakley@iee.org>
Date
Mar 20, 2014, 22:16 UTC
Message-ID
<BC292A8591EF4E8AB1E553FBF6ECC336@PhilipOakley>
In-Reply-To
<20140320195404.GA19252@sigill.intra.peff.net>
From: "Jeff King" <peff@peff.net>
Show 13 quoted lines
> On Thu, Feb 20, 2014 at 08:35:33AM +0100, Ephrim Khong wrote:
>
>> Hi, git log seems to omit merge commits that delete a file
>> if --follow or
>> --diff-filter=D is given. Below is a testcase. I'm not sure if it is
>> desired
>> behaviour for --diff-filter=D, but it's probably not correct
>> that --follow
>> _removes_ the merge commit from the log output.
>
> This is by design. Git-log does not calculate or show merge diffs
> unless
> "-c" or "--cc" is specified, and thus no diff-filter can match.

This is hard to discern from the log(1) man page as this conflates commit inclusion (limiting?) with the diff formatting.

The -c and -cc options are listed in the diff formatting section, but that's well down the man page. Even then, the note for the options doesn't say that it will cause the log output to now include the merge commits.

Perhaps the -c and -cc options should also be noted in the options or the commit limiting section, but exactly where is probably contentious (maybe under the --merges).

(or I may have misunderstood)
Show 14 quoted lines
>
>> echo "log 1 - no output"
>> # note that --diff-filter=A and M work as expected
>> # the merge does not show up for --diff-filter=ACDMRTUXB either
>> git log --pretty=oneline --diff-filter=D -- some_file
>
> Try:
>
>  git log -c --diff-filter=D -- some_file
>
> which does show it.
>
> -Peff
> --
Philip
Previous: Jeff KingNext: Jeff King
Message 3 of 6 in “git log omits deleting merges”
  1. Ephrim KhongFeb 20, 2014
  2. Jeff KingMar 20, 2014
  3. Philip OakleyMar 20, 2014
  4. Jeff KingMar 21, 2014
  5. Ephrim KhongMar 24, 2014
  6. Jeff KingMar 24, 2014

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.