I've been investigating ways to incorporate third-party repositories and
libraries into my Git projects. Subversion's
svn:externals capabilities are one compelling feature for that particular VCS,
and few, if any, other VCS systems, particularly the DVCS systems, have a truly
viable equivalent. Git
submodules aren't terrible, but they assume you want the
entire repository -- whereas SVN allows you to cherry-pick subdirectories if
Why might I want to link only a subdirectory? Consider a project with this structure:
docs/ api/ manual/ html/ module_specs/ library/ Foo/ ComponentA/ ComponentB/ tests/ Foo/ ComponentA/ ComponentB/
On another project, I want to use ComponentB. With
svn:externals, this is
and now the directory is added and tracked.
With Git, it's a different story. One solution I've found is using
git-subtree, an extension to Git. It
takes a bit more effort to setup than
svn:externals, but offers the benefits
of easily freezing on a specific commit, and squashing all changes into a single
Jon Whitcraft recently had some questions about how to use it, and I answered him via email. Evidently what I gave him worked for him, as he then requested if he could post my guide -- which you can find here.
I've been playing around with Git in the past couple months, and have been really enjoying it. Paired with subversion, I get the best of all worlds -- distributed source control when I want it (working on new features or trying out performance tuning), and non-distributed source control for my public commits.
Github suggests that when working with remote repositories, you turn on the autocrlf option, which ensures that changes in line endings do not get accounted for when pushing to and pulling from the remote repo. However, when working with git-svn, this actually causes issues. After turning this option on, I started getting the error "Delta source ended unexpectedly" from git-svn. After a bunch of aimless tinkering, I finally asked myself the questions, "When did this start happening?" and, "Have I changed anything with Git lately?" Once I'd backed out the config change, all started working again.
In summary: don't use "git config --global core.autocrlf true" when using git-svn.