Chapter 9 of the Pro Git book has a Deleting Objects section.
Let me summarize the following steps here:
git filter-branch --index-filter \ 'git rm --cached --ignore-unmatch path/to/mylarge_50mb_file' \ --tag-name-filter cat -- --all
Like the previously described reload option, filter-branch performs a rewrite operation. If you published a story, you need --force click the new links.
The filter-branch approach is significantly more powerful than the rebase approach because it
- allows you to work with all branches / links at once,
- renames any tags on the fly
- works cleanly even if several merge merges have been performed since the file was added,
- works cleanly even if the file has been re-added / deleted several times in the history of (a) branch (es)
- It does not create new, unrelated commits, but copies them when changing the trees associated with them. This means that things like signed commits, commit notes, etc. are saved.
filter-branch also saves backups, so the repo size will not decrease immediately unless you finish collecting logs and garbage:
rm -Rf .git/refs/original
sehe Jan 05 '12 at 11:15 2012-01-05 11:15
source share