问题
Hello I have successfully rewrote history and got the 5 folders I wanted to extract using git filter-branch -f --prune-empty --tree-filter 'rm -rf <all unwanted dirs>'
and kept all git history.
The only remaining issue are submodules, I sill have commits doing
Subproject commit <hash>
and I want to completely remove ALL of those submodule commits from my git history, how can I accomplish this?
回答1:
I have done it with
git filter-branch -f --prune-empty --tree-filter '
git submodule deinit -f .
git rm -rf lib && rm -rf lib
find . -name .gitmodules -delete' HEAD
Assuming that all of my submodules were located in lib
directory
来源:https://stackoverflow.com/questions/23207104/git-filter-branch-remove-all-submodules-from-my-repo