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
ØHØyvind Harboe <oyvind.harboe@zylin.com>
Date
Jan 7, 2009, 08:26 UTC
Message-ID
<c09652430901070026m6ca0ec98ndc7483aac8dfde89@mail.gmail.com>
In-Reply-To
<c09652430901061359q7a02291fk656ab23e54b19f5e@mail.gmail.com>

Here is a summary of the solution I used. I'm a beginner in git and just summarizing what others told me and what I did. Use at your own risk!

1. Remove anything you know should be removed, e.g.:

git filter-branch --tree-filter 'find . -regex ".*toolchain\..*" -exec rm -f {} \;' HEAD

2. Expire the log:
git reflog expire --all
3. Delete stuff from .git that should be manually "verified" to be
correct. I don't actually
know how to "verify" that at this point... Use backups Luke!

rm -rf .git/refs/original # delete lines w/"refs/original" from .git/packed-refs vi .git/packed-refs # for good measure... git reflog expire --all git gc

4. Your repository is still huge. By creating a new repository and pulling from
this one, the garbage will stay in the old one...

mkdir newrep cd newrep git init git pull file:///oldrep

5. Check size of .git. If it is still too big, try figuring out which
files that are big by looking at the packs(.git/objects/pack/xxx):
$ git verify-pack -v $PACK | grep -v "^chain " | sort -n -k 4
and then for the last few lines do a
$ git rev-list --all --objects | grep $SHA1
6. Go back to #1 until done.
Your repository should now be of reasonable size...

I've found some great scripts for converting from svn/cvs, but really the above procedure is necessary to run when converting nasty old repositories...

-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer
Previous: Nicolas PitreNext: Nicolas Pitre
Message 12 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.