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.84k stars 535 forks source link

The object files are redownloaded after fetching from remote #411

Closed aminya closed 3 years ago

aminya commented 3 years ago

I have written a script to remove some of the folders that we don't need to track to reduce the size of the repository. After running the script, the size of my repo becomes 15MB. When I git push -force to update the Github repository, it works without issues. However, when I clone the repository again, the size of the clone is 150 MB. Which means the objects files are still in the history. How can I fix this issue?

PowerShell

# Warning! Make sure that you understand what this does

# clone:
# git clone https://github.com/IrisSat/IrisSat-Flight-Software.git
# cd "IrisSat-Flight-Software"

$paths = "cdh-tsat5-libero/simulation",
"cdh-tsat5-libero/package",
"cdh-tsat5-libero/tooldata",
"cdh-tsat5-libero/viewdraw",
"cdh-tsat5-libero/stimulus",
"cdh-tsat5-libero/synthesis",
"cdh-tsat5-libero/designer",
"mbsat-fsw-libero/simulation",
"mbsat-fsw-libero/package",
"mbsat-fsw-libero/tooldata",
"mbsat-fsw-libero/viewdraw",
"mbsat-fsw-libero/stimulus",
"mbsat-fsw-libero/synthesis",
"mbsat-fsw-libero/designer",
"iris-fsw-libero/simulation",
"iris-fsw-libero/package",
"iris-fsw-libero/tooldata",
"iris-fsw-libero/viewdraw",
"iris-fsw-libero/stimulus",
"iris-fsw-libero/synthesis",
"iris-fsw-libero/designer"

foreach ($path in $paths) {
   $folder=(Split-Path -Path $path -leaf)
   java -jar C:/Users/aminy/bfg-1.13.0.jar --delete-folders $folder --no-blob-protection .
   if (test-path $path) {
      rm $path -Recurse -Force
   }
   git reflog expire --expire=now --all && git gc --prune=now --aggressive
}

Issue: https://github.com/IrisSat/IrisSat-Flight-Software/issues/15

aminya commented 3 years ago

Pushing all the branches fixes the issue.

git push --force --all origin