rtyley / bfg-repo-cleaner

Removes large or troublesome blobs like git-filter-branch does, but faster. And written in Scala
https://rtyley.github.io/bfg-repo-cleaner/
GNU General Public License v3.0
10.95k stars 540 forks source link

commit hashes changed after using bfg cleaner, making superrepo tags useless -> unable to check out #300

Open rikobrandes opened 5 years ago

rikobrandes commented 5 years ago

This is what I did to clean up a git SUBMODULE repo First I made a fork as a backup.

  1. git clone --mirror git://example.com/SUBMODULE_repo.git
  2. bfg --delete-folders folder --no-blob-protection SUBMODULE_repo.git
  3. cd SUBMODULE_repo.git
  4. git reflog expire --expire=now --all && git gc --prune=now --aggressive 5.git push

Everything is clean, but the commit hashes of all commits were changed. This way, since the hashed are linked to super repo commits, I cannot checkout super repo commits anymore, since the corresponding hashes of commit in the supbmodule repo cannot be found any more. Is there a way, to clean up , but keep the commit hashes as they were?

Thanks in advance.

javabrett commented 5 years ago

Commit-hash changes are expected, unavoidable, and non-BFG-specific. Any tool rewriting a Git history producing a sane result will result in commit-hash changed.

You will need to update the commit pointers in any repos which point at this repo, or alias in some other way.

bsrz commented 4 years ago

I am having a similar issue. I fully expected the hashes to be different. However, it would be great if BFG could recreate tags on the new hashes. Thoughts?