git 如何在一个父项目里管理目录重叠的两个 submodule

查看 40|回复 1
作者:cnt2ex   
场景:利用 git bare repo 来管理 dotfiles ,这里提到的。
为了更方便的初始化 ohmyzsh ,把 ohmyzsh 作为 submodule 加入了进去:
git--git-dir=$HOME/.cfg/ --work-tree=$HOME submodule add -b master https://github.com/ohmyzsh/ohmyzsh .oh-my-zsh
同时,ohmyzsh 也包含了一些插件,比如 zsh-autosuggestions ,但是如果再通过 submodule add 加入,尝试
git--git-dir=$HOME/.cfg/ --work-tree=$HOME submodule add -f -b master https://github.com/zsh-users/zsh-autosuggestions .oh-my-zsh/custom/plugins/zsh-autosuggestions
(加上-f 是因为 ohmyzsh 的.gitignore 忽略了 custom/这个目录)
会报错:fatal: Pathspec '.oh-my-zsh/custom/plugins/zsh-autosuggestions' is in submodule '.oh-my-zsh'
似乎 git 不允许两个 submodule 的目录重叠?有没有什么比较好的方法能处理这种情况呢?

submodule, ohmyzsh, git, add

zizon   
repo 建个目录符号链 submodule 需要的部分?
您需要登录后才可以回帖 登录 | 立即注册

返回顶部