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

Re: "git diff --stat" doesn't show added empty file

From
Ping Yin <pkufranky@gmail.com>
Date
Jan 13, 2009, 07:42 UTC
Message-ID
<46dff0320901122342q75e3e9e0gfe4e83bc7c60f193@mail.gmail.com>
In-Reply-To
<alpine.LFD.2.00.0901120805310.6528@localhost.localdomain>

On Tue, Jan 13, 2009 at 12:13 AM, Linus Torvalds <torvalds@linux-foundation.org> wrote:

Show 28 quoted lines
>
>
> On Mon, 12 Jan 2009, Ping Yin wrote:
>> $ git diff --stat HEAD^..
>>  0 files changed, 0 insertions(+), 0 deletions(-)
>
> In the kernel, we use "git diff --stat --summary" for exactly this reason.
>
> Well, not exactly.
>
> The thing is, even if the file is _not_ empty, there's a huge difference
> between "added 100 lines to an already-existing file" and "created a new
> 100-line file". Which is exactly what "--summary" adds.
>
> And it sometimes even makes sense to show the summary without the
> diffstat. If you're _only_ interested in create/delete/rename information,
> you can do "git show --summary <cmit>". It won't give you line counts, but
> it will give you information about any changes to filenames, eg in the
> kernel archive, you could see an example of this with
>
>        git show -M --summary 95b482a8d31116f3f5c2a5089569393234d06385
>
> where you have a combination of renames, creates and deletes.
>
> So I think it's already better than what you ask for.
>
>                        Linus
>

Thanks. --summary works. I just want to get all changed files. I think "git diff --name-status A..B" should be better.

Ping Yin
Previous: Linus Torvalds
Message 6 of 6 in “"git diff --stat" doesn't show added empty file”
  1. Ping YinJan 12, 2009
  2. Johannes SchindelinJan 12, 2009
  3. Michael J GruberJan 12, 2009
  4. Johannes SchindelinJan 13, 2009
  5. Linus TorvaldsJan 12, 2009
  6. Ping YinJan 13, 2009

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.