Created
January 24, 2012 07:37
-
-
Save mockdeep/1668698 to your computer and use it in GitHub Desktop.
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
# first clone your repo | |
git clone path/to/my/repo path/to/clone | |
# do some initial housecleaning: | |
rm -rf .git/refs/original/ | |
git reflog expire --expire=now --all | |
git gc --prune=now | |
git gc --aggressive --prune=now | |
# note the repo size: | |
du | |
# find the commits where the file was removed: | |
git rev-list -n 1 HEAD -- ./tapjoyads/data/GeoIPCity.dat | |
git rev-list -n 1 HEAD -- ./tapjoyads/data/GeoLiteCity.dat | |
# check out the file from that commit: | |
# (you may need to remove GeoIPCity.dat from .gitignore) | |
git checkout <commit hash>^ ./tapjoyads/data/GeoIPCity.dat | |
git checkout <commit hash>^ ./tapjoyads/data/GeoLiteCity.dat | |
# notice the carat -------^ | |
# commit the files: | |
git commit # add a message | |
# purge it! (these will take a long time...) | |
git filter-branch --index-filter 'git rm --cached --ignore-unmatch ./tapjoyads/data/GeoIPCity.dat' -f | |
git filter-branch --index-filter 'git rm --cached --ignore-unmatch ./tapjoyads/data/GeoLiteCity.dat' -f | |
# and do some gc: | |
rm -rf .git/refs/original/ | |
git reflog expire --expire=now --all | |
git gc --prune=now | |
git gc --aggressive --prune=now | |
# and find out if it was worth it: | |
du |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment