tags:

views:

841

answers:

3

I have two SVN project using sharing another SVN using svn:externals. I want to have that same structure with GIT but I can't find how.

+1  A: 

There isn't an exact analogue, but here are a pair of workarounds:

Hank Gay
+2  A: 

You should look into git submodules, it should allow almost exactly what you're looking for.

foxxtrot
+9  A: 

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 on 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 were to merge from your code, the project histories get merged and the two projects effectively become one.

  • Git submodules link to a particular commit in another project's repository, while svn:externals always fetch the latest revision. 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.

Paul
FYI, it is now possible to specify specific revisions with svn:externals now (since 1.5 or 1.6 I believe?)
drhorrible