git filter-branch从我的仓库中删除所有子模块 [英] git filter-branch remove all submodules from my repo

查看:258
本文介绍了git filter-branch从我的仓库中删除所有子模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我已经成功重写了历史记录,并使用git filter-branch -f --prune-empty --tree-filter 'rm -rf <all unwanted dirs>'提取了5个要提取的文件夹,并保留了所有git历史记录.

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>

并且我想从我的git历史记录中完全删除所有这些子模块提交,我该怎么做?

and I want to completely remove ALL of those submodule commits from my git history, how can I accomplish this?

推荐答案

我已经完成了

git filter-branch -f --prune-empty --tree-filter '
    git submodule deinit -f .
    git rm -rf lib && rm -rf lib
    find . -name .gitmodules -delete' HEAD

假设我所有的子模块都位于lib目录中

Assuming that all of my submodules were located in lib directory

这篇关于git filter-branch从我的仓库中删除所有子模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆