Search code examples
gitbitbucketbfg-repo-cleaner

How clean git repository with commit which not in work tree


I cleaned the Git repository (Bitbucket cloud) with bfg, but the last commit remained uncleaned (as written in the bfg documentation: By default the BFG doesn't modify the contents of your latest commit on your master (or 'HEAD') branch, even though it will clean all the commits before it.).

However, I didn’t see it and wanted to run git gc in a Bitbucket.
For this I did "git reset --hard HEAD" and rolled back to it then "git push --force".
But repository size increased?!

Now I have this commit with the old history left in the repository, and bfg cannot clean it, what should I do?
How can I remove it, since it is no longer attached to the working tree?


Solution

  • I wrote in bitbucket support, they ran the script "git gc" on server and the old story was cleaned