0

A huge folder in my repository has filled up my LFS. As instructed here, I wish to remove the folder from the remote repository and then re-write history to drop it from all previous commits. That should free up lots of space in my LFS, but is not. What am I missing?

Say the repository is repo and the folder in question is repo/unwantedFolder.

I did the following steps:

  1. Removed the unwantedFolder and re-committed:

    $ git rm -r --cached unwantedFolder/
    $ git commit -a -m 'Drops folder'
    $ git push origin
    
  2. Mirror-cloned the repo:

    $ git clone --mirror https://github.com/emagar/repo.git
    
  3. Re-wrote history:

    $ java -jar bfg.jar --delete-folders unwantedFolder repo.git/
    
  4. Moved into the manipulated cloned repo: $ cd repo.git/
  5. Used the git gc command:

    $ git reflog expire --expire=now --all && git gc --prune=now --aggressive
    
  6. Pushed the clean repository: $ git push origin
  7. Moved back to the original repository: $ cd repo/
  8. Pulled from github: $ git pull origin master

While all seemed to work well, when I inspect old commits in github, the unwantedFolder/ still appears there!

What am I missing?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
emagar
  • 985
  • 2
  • 14
  • 28
  • 1
    I have not actually used git-lfs but logically the large files stored *outside* Git need some sort of outside "discard old large files" stimulator. The problem here is similar to that of submodules: the *repository* has only a reference to (hash ID for) the content; the content is stored separately; the content server has no idea when, or if-ever-at-all, someone will come along and say "give me the content for hash $H". – torek Mar 09 '18 at 14:51
  • Is the [lfs] tag appropriate here? – cst1992 Mar 10 '18 at 11:59
  • I presume the [lfs] tag is appropriate---it is files that are stored in the remote lfs that I wish to expunge from the repository's history. If this is wrong, I can remove the tag... – emagar Mar 10 '18 at 15:22
  • How did you inspect old commits, and which branch are they from? This question could use a publicly-reproducible example repo - the one above has been deleted or redacted. – javabrett Aug 03 '18 at 20:10

0 Answers0