假设我有一个Common
可以独立使用的库,并且被项目P1
和使用P2
,所以我想要的树看起来像
/Common/.git
...
/P1/.git
.gitmodules # points to remote server
Common/
...
/P2/.git
.gitmodules # points to remote server
Common/
...
当我在 中进行更改时/Common
,我希望能够在提交之前使用P1
和测试它。P2
使用通常的git submodule
命令集,我必须从 提交/Common
,推送到远程,然后从两者中拉取/P1/Common
和/P2/Common
。如果提交破坏了某些内容,则无法对其进行修改,因为错误的更改已经发布。或者,我可以git remote add quicktest /Common
在/P?/Common
不接触远程服务器的情况下进行拉取。但这有很多不一致的机会,并且从中删除损坏的提交/P?/Common
以便可以在/Common
.
我宁愿在开发过程/Common
中使用P1
and中的工作树P2
,但我无法创建/P1/Common
符号链接,/Common
因为git submodule
将符号链接识别为与目录不同。大多数文件系统不允许硬链接目录。我可以使用硬链接所有文件
rm -rf /P1/Common
cp -rl /Common /P1/Common
在添加新文件之前效果很好,/Common
在这种情况下需要重复此过程。两者都有优雅的方式吗
- 继续
git clone --recursive git://remote/P1.git
为最终用户工作,并且 - 让我可以轻松地测试
/Common
使用P1
和P2
?