有什么问题可以git subtree
解决?何时以及为什么要使用该功能?
我已经读过它用于存储库分离.但为什么我不只是创建两个独立的存储库而不是将两个不相关的存储库合二为一?
这个GitHub教程解释了如何执行Git子树合并.
我知道如何使用它,但不知道何时(用例)及其原因,以及它与之相关的方式git submodule
.当我依赖于另一个项目或库时,我会使用子模块.
我有一个大项目(让我们说A repo
),它有一个来自的子文件夹B repo
.当我承诺时,我会像下面那样遇到警告A repo
warning: adding embedded git repository: extractor/annotator-server
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> extractor/annotator-server
hint:
hint: If you added this path by mistake, you can remove it from the …
Run Code Online (Sandbox Code Playgroud) 我在一所学校编写代码,要求我们用git将所有工作提交给他们的服务器.每个作业都有自己的文件夹,该文件夹具有自己的.git目录.
我正在尝试将父文件夹推送到我的github,但是当我执行推送它实际上并没有上传文件夹内的代码,因为它被认为是一个子模块.我已经尝试制作一个忽略所有.git文件夹的.gitignore文件,但这不起作用.
我看到的唯一解决方案是每次我想将项目内的更改推送到我的github时手动执行git远程,或者编写一个脚本,将父目录的内容与第二个目录同步,然后删除所有推送之前.git文件夹里面.
有没有办法干净地推送到github而无需手动推送每个文件夹,而且不必为了推送到github而创建一个基本上是我的工作副本的目录?