Search code examples
gitjargit-rewrite-historybfg-repo-cleaner

Removing files from GIT history


I have a lot of jar files in my git history, and it is taking up a lot of space. Can I use BFG Repo Cleaner to delete all jar files from my history?

I think running the --delete-files command like that bfg --delete-files .jar <git repo name>.git, but I am not sure about it.

Is this the right way to do this? If not, how can I remove all jar files from my history?

Thanks.


Solution

  • Yes it seems to be the good way to do. BFG is the better tool to remove files in history and taking car of your history.

    Be aware that BFG, never touch the last commit (for safety purpose, to be able to always build the last version), so if needed, you will need to remove the jar files yourself from this last commit.

    For safety, I highly recommend you to copy your repository before doing something and try the command before verifying if the result suits you.