Rewriting a repository can remove unwanted history to make the repository smaller. We recommend git filter-repo over git filter-branch and BFG.
Rewriting repository history is a destructive operation. Make sure to back up your repository before you begin. The best way back up a repository is to export the project.