问题
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:
Removed the unwantedFolder and re-committed:
$ git rm -r --cached unwantedFolder/ $ git commit -a -m 'Drops folder' $ git push origin
Mirror-cloned the repo:
$ git clone --mirror https://github.com/emagar/repo.git
Re-wrote history:
$ java -jar bfg.jar --delete-folders unwantedFolder repo.git/
- Moved into the manipulated cloned repo:
$ cd repo.git/
Used the git gc command:
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive
- Pushed the clean repository:
$ git push origin
- Moved back to the original repository:
$ cd repo/
- 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?
来源:https://stackoverflow.com/questions/49185076/re-wrote-git-history-with-bfg-but-not-reflected-in-earlier-commits