Last active
August 29, 2015 14:02
-
-
Save amenk/aa98d11015c73090923d to your computer and use it in GitHub Desktop.
Clean media folder from repository
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
git clone repo-backup/ repo-min | |
cd repo-min/ | |
# make sure you do not have other branches | |
git filter-branch --tree-filter 'rm -rf public/media/*' HEAD | |
git update-ref -d refs/original/refs/heads/master | |
git remote rm origin | |
git repack -ad | |
du -hs .git # 2.4 GB | |
git whatchanged # check that files are not there | |
git reflog expire --expire=now --all | |
git gc --prune=now --aggressive | |
du -hs .git # 70 MB | |
git add origin ..... | |
git push --mirror origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment