Reduce size of .git Folder

.git folder for git sometimes ends up tens of megabyte. Such unusual size is usually caused by misconfigure of .gitignore, causing git recording changes of large files such as images and videos.

Reduce size of .git Folder


Remove Git Log of Unwanted Files

e.g. images; videos

git filter-branch --force --tree-filter 'rm -f path/to/big_file.mpg' HEAD
git reflog expire --expire=now --all
git gc --prune=now --aggressive
git push --force origin master