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

Re: Problems getting rid of large files using git-filter-branch

From
Nicolas Pitre <nico@cam.org>
Date
Jan 6, 2009, 22:31 UTC
Message-ID
<alpine.LFD.2.00.0901061709510.26118@xanadu.home>
In-Reply-To
<c09652430901061359q7a02291fk656ab23e54b19f5e@mail.gmail.com>
On Tue, 6 Jan 2009, Øyvind Harboe wrote:
Show 22 quoted lines
> Q1: How can I figure out what it is in .git that takes so much space?
> 
> Q2: Where can I read more about what to do after running git-filter-branch to
> removing the offending objects?
> 
> 
> 
> 1. I ran this command to get rid of the offending files and that appears to
> have worked. I can't find any traces of them anymore...
> 
> git filter-branch --tree-filter 'find . -regex ".*toolchain\..*" -exec
> rm -f {} \;' HEAD
> 
> 2. Running "git gc" takes a few seconds. The repository is still
> huge(it should be
> perhaps 10-20mByte).
> 
> du -skh .git/
> 187M    .git/
> 
> 3. I tried "git reflog expire --all" + lots of other tricks in the
> link below, but no luck.
OK, try this:
	cd ..
	mv my_repo my_repo.orig
	mkdir my_repo
	cd my_repo
	git init
	git pull file://$(pwd)/../my_repo.orig

This is the easiest way to ensure you have only the necessary objects in the new repo, without all the extra stuff tied to reflogs, etc.

Then, if your repo is still seemingly too big, you can get a bit dirty with the sequence Johannes just posted.

Nicolas
Previous: Sitaram ChamartyNext: Øyvind Harboe
Message 8 of 13 in “Problems getting rid of large files using git-filter-branch”
  1. Øyvind HarboeJan 6, 2009
  2. Johannes SchindelinJan 6, 2009
  3. Øyvind HarboeJan 6, 2009
  4. Johannes SchindelinJan 7, 2009
  5. Øyvind HarboeJan 7, 2009
  6. Johannes SchindelinJan 7, 2009
  7. Sitaram ChamartyJan 7, 2009
  8. Nicolas PitreJan 6, 2009
  9. Øyvind HarboeJan 6, 2009
  10. Stephen R. van den BergJan 6, 2009
  11. Nicolas PitreJan 7, 2009
  12. Øyvind HarboeJan 7, 2009
  13. Nicolas PitreJan 7, 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.