Re-wrote git history with bfg but not reflected in earlier commits

孤人 提交于 2019-12-24 21:19:23

问题


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?

来源:https://stackoverflow.com/questions/49185076/re-wrote-git-history-with-bfg-but-not-reflected-in-earlier-commits

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!