git - 将子模块添加到 git 项目并下载其内容

标签 git

我已经创建了包含内容的 .gitmodules 文件

[submodule "xxxx/src/main/webapp/js/app/ui"]
    path = xxx/src/main/webapp/js/app/ui
    url = <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="02656b7642656b766a77602c616d6f" rel="noreferrer noopener nofollow">[email protected]</a>:xxx/task-core.git

但是如何使其内容出现在src/main/webapp/js/app/ui中呢? 我做到了

git submodule init
git submodule update

但我的文件夹仍然是空的。

最佳答案

不要手动添加对 .gitmodules 的子模块引用,而是使用 git submodule add。清理您的 .gitmodules 文件,然后尝试以下操作:

git submodule add <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1c7b75685c7b756874697e327f7371" rel="noreferrer noopener nofollow">[email protected]</a>:xxx/task-core.git -- xxx/src/main/webapp/js/app/ui

然后您应该会看到编辑后的 ​​.gitmodules 以及 git status 中列出的子模块目录。

现在是运行的好时机:

git submodule init
git submodule update

如需进一步引用,请查看this chapter of git-scm .

关于git - 将子模块添加到 git 项目并下载其内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29388029/

相关文章:

git - 如何在没有中央存储库的情况下设置 git?

git - 在一个 rebase 后 merge 来自相似分支的选定文件

git - Mathematica 笔记本的版本控制

git difftool --dir-diff : how to copy back changed files

git fetch 后的 Git 日志

svn - git 是否有类似 `svn propset svn:keywords` 或提交前/提交后的 Hook ?

git - 在多个客户的网络项目中使用 git

GitHub 分支之间的 pull 请求

git - phpstorm 在错误的目录中寻找 ssh key

git - 如何让 GRAV git-sync 插件在 Azure 网站中工作