Re: Problems getting rid of large files using git-filter-branch
- From
- Ø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