My configuration for using BFG Repo-Cleaner
Follow the clone guildelines as outlined at BFG Repo-Cleaner using the --mirror flag. This is important!
I created a git alias so I wouldn't have to specify the path the jar file. This is optional and is only to make my life easier.
Without the alias, you will need to specify the path to the jar file which becomes very tedious. Without the alias, you will need to execute the command like this:
With the alias, you can simplify the command like this:
Either way, the format follows this pattern:
You do not specify the path to the file to remove. This little bit of information has bitten me more than once and I have to remind myself that I am not removing an actual file, but removing objects that contain references to that file. The important thing to understand here is that each specific version of a file, folder, or commit is an object in Git and it is assigned an immutable hash id. The hash depends not only on the current content being changed, but the also commits that came before it. BFG is removing the history of that file, which changes the hash of that commit, and every commit that came after it just like you would do with filter-branch, but only faster!
BFG will also update commit messages that include the hash that is being rewritten to include the updated commit hash.