“子模块”在 git 中:辫子或子树或其他东西

发布于 2024-09-26 00:35:33 字数 177 浏览 0 评论 0原文

要在我的“主”存储库中包含一些外部 git 存储库,有几个选项:

  • 子模块
  • 编织
  • 子树

第一个似乎基本上每个人都不建议这样做。我认为第二个和第三个是子树模式的实现。

有一个更好吗?我应该使用哪个?为什么?我该如何在它们之间进行选择?

To include a few external git repositories in my "main" repository, there are a few options:

  • submodules
  • braid
  • subtree

The first seems to be advised against by basically everybody. The second and third I believe are implementations of the subtree pattern.

Is one better? Which should I use? Why? How can I choose between them?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暗地喜欢 2024-10-03 00:35:33
  • 子模块非常适合:

    • 引用另一个存储库的一个特定提交(真正相当于带有显式修订号的 svn external),
    • 将两个历史记录(父存储库和外部存储库)分开(如基于组件的方法)。
  • 子树非常适合将一个存储库的历史记录包含到另一个存储库中。

因此,如果这几个外部存储库没有能力最终获得主父级的所有标签和提交历史记录,请使用子模块。
否则,子树就可以了。

  • submodule is great to:

    • reference one specific commit of another repo (true equivalent of svn external with explicit revision numbers),
    • keep the two histories (the parent repo and the external repo) separate (as in a component-based approach).
  • subtree is great for including the history of one repo into another.

So if those few external repositories have no vocation to end up with all the tags and commit history of the main parent parent, use submodules.
Otherwise, subtree is fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文