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

Re: Unable to shrink repository size

From
Fredrik Gustafsson <iveqy@iveqy.com>
Date
Mar 6, 2014, 07:46 UTC
Message-ID
<20140306074610.GO24892@paksenarrion.iveqy.com>
In-Reply-To
<CAHd499AW6nev81iVVhuoYfT0us28SSBDwbHCBa3teYB=cJR99g@mail.gmail.com>
On Wed, Mar 05, 2014 at 08:55:30PM -0600, Robert Dailey wrote:
Show 10 quoted lines
> What I'd like to do is somehow hunt down the largest commit (*not*
> blob) in the entire history of the repository to hopefully find out
> where huge directories have been checked in.
> 
> I can't do a search for largest file (which most google results seem
> to show to do) since the culprit is really thousands of unnecessary
> files checked into a single subdirectory somewhere in history.
> 
> Can anyone offer me some advice to help me reduce the size of my repo
> further? Thanks.

I'm not sure if you can do this with git. However since git is a command line application it's pretty easy to script it with sh. The negative part beeing the lack of speed, but since this is a one-time thing I don't think that it matters.

Since you told us that it is a commit with a huge number of files that you're looking for, I took that approach instead of calculating the size of each commit, since that would be more expensive to do.

for commit in $(git log --pretty=oneline | cut -d " " -f 1)
do
	nbr=$(git show --pretty="format:" --name-only $commit | wc -l)
	echo "$nbr: $commit"
done | sort | tail -1

This will give you the commit with most files changed. (Although, there will be a +1 error on the number of files edited).

-- 
Med vänlig hälsning
Fredrik Gustafsson

tel: 0733-608274
e-post: iveqy@iveqy.com
Previous: Elijah NewrenNext: Duy Nguyen
Message 3 of 5 in “Unable to shrink repository size”
  1. Robert DaileyMar 6, 2014
  2. Elijah NewrenMar 6, 2014
  3. Fredrik GustafssonMar 6, 2014
  4. Duy NguyenMar 6, 2014
  5. Jeff KingMar 6, 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.