SVN:外部等效于 Git? [英] SVN:externals equivalent in Git?

查看:17
本文介绍了SVN:外部等效于 Git?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个 SVN 项目正在使用 svn:externals.

I have two SVN projects in use from another SVN repository using svn:externals.

如何在 Git 中拥有相同的存储库布局结构?

How can I have the same repository layout structure in Git?

推荐答案

Git 有两种类似但不完全等同于 svn:externals 的方法:

Git has two approaches similar to, but not exactly equivalent to svn:externals:

  • 子树合并 将外部项目的代码插入到您的存储库中的单独子目录中.这有一个详细的设置过程,然后很容易其他用户,因为在检出或克隆存储库时会自动包含它.这是在项目中包含依赖项的便捷方式.
    从其他项目中提取更改很容易,但提交更改很复杂.如果另一个项目必须从您的代码中合并,项目历史就会合并,这两个项目实际上合二为一.

  • Subtree merges insert the external project's code into a separate sub-directory within your repo. This has a detailed process to set up and then is very easy for other users, because it is automatically included when the repository is checked out or cloned. This can be a convenient way to include a dependency in your project.
    It is easy to pull changes from the other project, but complicated to submit changes back. And if the other project have to merge from your code, the project histories get merged and the two projects effectively become one.

Git 子模块(manual) 链接到另一个项目的存储库中的特定提交,很像带有 -r 参数.子模块易于设置,但所有用户都必须管理子模块,这些子模块不会自动包含在检出(或克隆)中.
尽管将更改提交回另一个项目很容易,但如果 repo 发生更改,这样做可能会导致问题.因此,将更改提交回正在积极开发的项目通常是不合适的.

Git submodules (manual) link to a particular commit in another project's repository, much like svn:externals with an -r argument. Submodules are easy to set up, but all users have to manage the submodules, which are not automatically included in checkouts (or clones).
Although it is easy to submit changes back to the other project, doing so may cause problems if the repo has changed. Therefore it is generally not appropriate to submit changes back to a project that is under active development.

这篇关于SVN:外部等效于 Git?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆