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 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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…