When you have something in your repo that you want to get rid of.
This can happen if you commit before you had the proper .gitignore there, or you committed security info you should not have, or just got a lot of rubbish in there.
Even if you have removed them from your branch, they will still exist in history, so these commands will remove the files from all history.
It also means, that once you have pushed this up to the cloud storage, then everyone else will have to do a new clone (and remove their old clones first) to get the new cleaned repo.
Requirement: You need Python installed, or use it from a container. But everyone have Python installed, right?
Also see Andrew Locks post
pip install --user git-filter-repo
git filter-repo --path <file> --invert-paths
git filter-repo --path <folder> --invert-paths
Docs says you can use wildcards, but it doesn't seem to work if they are placed lower in the tree.
--path */bin/* will not work, but
--path */bin will.