Created
September 19, 2013 07:58
-
-
Save Crydust/6620348 to your computer and use it in GitHub Desktop.
Also see "Removing a File from Every Commit"
http://git-scm.com/book/en/Git-Tools-Rewriting-History
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Warning this is a destructive operation. | |
git ls-tree --abbrev -r -l HEAD | sort +3 | tail | |
git filter-branch --all --tree-filter 'rm -f blueray.iso' HEAD | |
# Git keeps track of the original refs which keeps the repo large. | |
# We remove those now. | |
# 1) Make sure original refs are gone: | |
rm -rf .git/refs/original | |
# 2) Expire all reflog entries: | |
git reflog expire --all --expire='0 days' | |
# 3) Check for old packed refs | |
cp .git/packed-refs .git/packed-refs~ | |
vi .git/packed-refs | |
rm -rf .git/refs/original/ | |
git fsck --full --unreachable | |
# 4) Repack your packed archive(s) | |
git repack -A -d | |
# 5) Prune loose (unreachable) objects | |
git gc --prune=now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment