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

Re: hot to get file sizes in git log output

From
DLDavid Lang <david@lang.hm>
Date
Oct 21, 2017, 02:43 UTC
Message-ID
<nycvar.QRO.7.76.6.1710201940440.5973@qynat-yncgbc>
In-Reply-To
<nycvar.QRO.7.76.6.1710201929210.5973@qynat-yncgbc>
On Fri, 20 Oct 2017, David Lang wrote:
Show 19 quoted lines
> On Fri, 20 Oct 2017, Eric Sunshine wrote:
>
>>>> I'm not exactly sure what you mean by size, but if you want to show
>>>> how many lines were added and removed by a given commit for each file,
>>>> you can use the "--stat" option to produce a diffstat. The "size" of
>>>> the files in each commit isn't very meaningful to the commit itself,
>>>> but a stat of how much was removed might be more accurate to what
>>>> you're looking for.
>>> 
>>> That's a good suggestion, and hopefully could help David answer his
>>> original question.
>>> 
>>> I took the request to mean "walk through history, and for each file that
>>> a commit touches, show its size". Which is a bit harder to do, and I
>>> think you need to script a little:
>> 
>> David's mention of "a particular file", suggests to me that something
>> "bad" happened to one file, and he wants to know in which commit that
>> "badness" happened. If so, then it sounds like a job for git-bisect.
summarizing (and removing the long explination of why I'm doing this)

for each file (or each file changed in the commit), what is the byte count of that file at the time of that commit.

git whatschanged currently reports
commit 17be1c1e1f80086e8ddda1706c8c8d6cf80d26b7
Author: David Lang <david@lang.hm>
Date:   Thu Oct 19 22:00:01 2017 -0700
     update
:100644 100644 bb9dcd3... 8635d2b... M  Default/Current Session
commit d3f94d406e0d5c6ee7b6f6bcea019adff438127c
Author: David Lang <david@lang.hm>
Date:   Thu Oct 19 21:00:01 2017 -0700
     update
:100644 100644 88ece53... bb9dcd3... M  Default/Current Session
commit fea290bd235a444bbd4bc4430fa0844501ae2b8c
Author: David Lang <david@lang.hm>
Date:   Thu Oct 19 06:00:01 2017 -0700
     update
:100644 100644 ff04089... 88ece53... M  Default/Current Session
what is the size of the file "Current Session" for each commit?
David Lang
Previous: David LangNext: Jeff King
Message 7 of 8 in “hot to get file sizes in git log output”
  1. David LangOct 20, 2017
  2. Jacob KellerOct 20, 2017
  3. Jeff KingOct 20, 2017
  4. Eric SunshineOct 20, 2017
  5. Jacob KellerOct 20, 2017
  6. David LangOct 21, 2017
  7. David LangOct 21, 2017
  8. Jeff KingOct 21, 2017

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.