submoduleの追加
以下のコマンドで追加できる
git submodule add <URL> <path>
# 例
# git submodule add https://github.com/amatyrain/wordpress-client.git libs/wordpressalready exists in the indexで怒られる時
git submodule add https://github.com/XXX.git projectDir
fatal: 'projectDir' already exists in the index以下のコマンドでgitの管理対象から外せば、submoduleを追加できるようになります
git rm --cached submoduleDir
rm 'submoduleDir'指定したパスにすでにGitリポジトリが紐づいている場合
# $ git submodule add <URL> <path>
fatal: A git directory for <path> is found locally with remote(s):
origin <URL>
If you want to reuse this local git directory instead of cloning again from
<URL>
use the '--force' option. If the local git directory is not the correct repo
or you are unsure what this means choose another name with the '--name' option.他のリポジトリを紐づけたい時は、—forceで上書きしてあげればOK
git submodule add --force <URL> <path>
submoduleの削除
git rm -rf submoduleDir
rm 'submoduleDir'
記事一覧