Try and apply the new git filter-repo
, which does replace the old git filter-branch
or BFG.
It has many usage examples, including path-based filtering, in order for you to remote the src/assets/video/Greensleeves
file in past commits:
To keep all files except these paths, just add --invert-paths
:
git filter-repo --path src/assets/video/Greensleeves --invert-paths
Then git push --force
(that does rewrite the history of your repository, so make sure to notify any other collaborator)
Since it must be done on a fresh clone:
- Don't touch anything to your current clone folder
- Create a separate clone of the repository, where you do the filter repo
- In that second clone, now cleaned (no more big file in its history), import your work from your first repo
That is, for point 3:
cd /path/to/second/clone
git --work-tree=/path/to/first/original/clone add .
git commit -m "Import work from first clone"
git push --force