Welcome to Shaun Luttin's public notebook. It contains rough, practical notes. The guiding idea is that, despite what marketing tells us, there are no experts at anything. Sharing our half-baked ideas helps everyone. We're all just muddling thru. Find out more about our work at bigfont.ca.

Purge all files from every directory that has a specified prefix.

Tags: git, maintenance

Run this command, replacing resized with your target directory prefix.

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch *\*\resized**\*' --prune-empty --tag-name-filter cat -- --all

This will remove all files that are in any directory that starts with resized, such as resized80x100. Follow up with:

git push origin --force --all


git push origin --force --tag if you have tags.

The key for me was the *\*\resized**\* to match all files in any directory that starts with resized.

See also: https://help.github.com/articles/remove-sensitive-data/