リモートから新たに何かクローンしたい
既にgit initされているフォルダに別のモジュールをリモートからクローンしてくる場合を考える
$ git clone https://github.com/usr/something
これでクローンされた。
statusを見てみる
$ git status
Untracked files:
(use "git add <file>..." to include in what will be committed)
something/
git addすると警告が出る
$ git add .
warning: adding embedded git repository: something
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint: git submodule add <url> something
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached something
hint:
hint: See "git help submodule" for more information.
入っている様に見えるが、中身は空!
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: something #この中身が空!
別リポジトリからクローンしてきた.gitを消して下記コマンドで解決
$ rm -rf something/.git
$ git rm -f --cached something
$ git add .
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: something/.env.example
new file: something/.gitignore
new file: something/LICENSE
new file: something/Makefile
new file: something/README.md
new file: something/db/log/.gitignore
new file: something/db/my.cnf
new file: something/docker-compose.yml
new file: something/php/Dockerfile
new file: something/php/php.ini
new file: something/web/default.conf