purging stuff from git

Wanted to remove entire pdfs directory from and rewrite git history to remove all traces from it. First i deleted the directory manually and commited those changes.

rmdir /s /q pdfs
git add -u
git commit -m "delete pdfs"

The went about cleaning up git history thru filter-branch command. There are ample of warnings online about it being horribly slow (it was slow for me as well, took over ~2 hours to purge 2 directories).

git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch pdfs/" HEAD
Rewrite e59e7d42e69ad0cde259b32f63b43a70730f231b (1048/1097) (3254 seconds passed, remaining 152 predicted)
rm 'pdfs/NX-bit.pdf'
rm 'pdfs/OziMem08B.pdf'
rm 'pdfs/PointersAndMemory.pdf'
rm 'pdfs/Reinders_1045.pdf'
rm 'pdfs/Reinders_1300.pdf'
rm 'pdfs/Reinders_930.pdf'
rm 'pdfs/virtualization.pdf'
rm 'pdfs/whymb.2010.07.23a.pdf'
Rewrite eb2743f0f1f1c8375a5bd265a4acad1f2fb4adc3 (1097/1097) (3332 seconds passed, remaining 0 predicted)
Ref 'refs/heads/source' was rewritten

Once done then ensured that git does gc and helps reduce size

git update-ref -d refs/original/refs/heads/source
git reflog expire --expire=now --all
git gc --prune=now --aggressive
git push -f