Checkout sub directories in git (sparse checkouts)
//TODO en Français
SVN externals is a really nice feature I used a lot. Switching to git I was really missing it. Of course there is git-submodule but it’s not the same. Now, with version 1.7 git supports so called sparse checkouts which allow you to only include specific sub directories of a repository in your project. You still need to clone the whole repository, but afterwards you can tell git to only show the specified sub directories.
Here is how it works:
clone the other repository (in my case, for a Rails app, I did it in vendor/plugins/)
git clone <repository_url> <directory>
cd to <directory>
git config core.sparsecheckout true
add directories you want to have in your checkout to .git/info/sparse-checkout, e.g.