git 与 main 一起审查子模块代码

git submodule code review with main

我有一个名为 main 的存储库,其中有一个名为 sub 的子模块。我想要做的是当我在 mainsub 中进行更改时,使它们成为 gerrit 中同一代码审查的一部分。 有什么办法可以做到这一点?我似乎找不到任何信息来完成这项工作。 谢谢

这不可能!

Git manages the submodule with their commit SHA id. Hence, even a sub-repo resides in a subdirectory of the main repo on your local machine, Git sees it as a submodule and doesn’t track its contents. Instead, Git sees it as a particular commit from that repository.

因此,作为 Pull-request/Code-review 的一部分,您将在 git 存储库服务器上看到的是子模块的提交 SHA 中的更改。

尽管 git-repo-server 可以通过提供指向子模块-repo-url 的超链接为您提供一些轻松导航到子模块 repo。至少 bitbucket 提供了相同的。并且在导航到 submodule-repo 之后,可能还有另一个 Pull-request/Code-review 等待审阅者。