Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当子目录已经在git中时,将文件放入git repo_Git - Fatal编程技术网

当子目录已经在git中时,将文件放入git repo

当子目录已经在git中时,将文件放入git repo,git,Git,我在机器上有几个文件和目录,我想放在git中。 我发现一些子目录已经有了.git目录。 例如: parent #is the directory I want to add to git parent/child1 parent/child2 parent/child2/.git # all above are directories containing files. 尝试添加父级时,我看到以下内容: git add . warning: adding embedded git reposi

我在机器上有几个文件和目录,我想放在git中。 我发现一些子目录已经有了.git目录。 例如:

parent #is the directory I want to add to git
parent/child1
parent/child2
parent/child2/.git
# all above are directories containing files.
尝试添加父级时,我看到以下内容:

git add .
warning: adding embedded git repository: child2
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> child2
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint:   git rm --cached child2
hint:
hint: See "git help submodule" for more information.
git添加。
警告:添加嵌入式git存储库:child2
提示:您已经在当前存储库中添加了另一个git存储库。
提示:外部存储库的克隆将不包含
提示:嵌入的存储库,不知道如何获取它。
提示:如果要添加子模块,请使用:
提示:
提示:git子模块add child2
提示:
提示:如果您错误地添加了此路径,可以将其从
提示:索引中包含:
提示:
提示:git rm--缓存的child2
提示:
提示:有关更多信息,请参阅“git帮助子模块”。

如何将child2文件包含在我的父repo中?

当您尝试时,效果如何?现在还不清楚“将git添加到父目录”是什么意思,只是运行
git init
(这可能意味着什么的逻辑解释)除了初始化git repo之外不会“做”任何事情。子目录中的文件也会包含在父目录中吗?->不,除非您指定。我如何指定?(没有子模块)是否继续使用child2的存储库?如果没有,我想仅仅删除
parent/child2/.git
就是解决方案。是的,我不想删除child-git-repo,它们可以共存吗?当你尝试时,效果如何?现在还不清楚“将git添加到父目录”是什么意思,只是运行
git init
(这可能意味着什么的逻辑解释)除了初始化git repo之外不会“做”任何事情。子目录中的文件也会包含在父目录中吗?->不,除非您指定。我如何指定?(没有子模块)是否继续使用child2的存储库?如果没有,我想仅仅删除
parent/child2/.git
就是解决方案。是的,我不想删除child-git-repo,它们能共存吗?