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

Re: hot to get file sizes in git log output

From
Jacob Keller <jacob.keller@gmail.com>
Date
Oct 20, 2017, 21:54 UTC
Message-ID
<CA+P7+xqx3EDbRKq7rwHXn9qeqVTZCZr2vYZ_63THC+UEL5q2Yw@mail.gmail.com>
In-Reply-To
<CAPig+cQ56ZNaEOkV+ZCq2KsL-2nTockTrEbqvj=j_wO0YtCx6g@mail.gmail.com>
On Fri, Oct 20, 2017 at 2:50 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 26 quoted lines
> On Fri, Oct 20, 2017 at 5:43 PM, Jeff King <peff@peff.net> wrote:
>> On Fri, Oct 20, 2017 at 01:44:36PM -0700, Jacob Keller wrote:
>>> On Fri, Oct 20, 2017 at 11:12 AM, David Lang <david@lang.hm> wrote:
>>> > I'm needing to scan through git history looking for the file sizes (looking
>>> > for when a particular file shrunk drastically)
>>> >
>>> > I'm not seeing an option in git log or git whatchanged that gives me the
>>> > file size, am I overlooking something?
>>>
>>> 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.

Yea, if you have a simple script which can tell when the file is "bad", you could run it through git bisect run pretty easily and rapidly find the right answer.

Thanks, Jake

Previous: Eric SunshineNext: David Lang
Message 5 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.