Please note: I am not looking for git sparse checkout, nor is this question a duplicate of Is there any way to clone a git repository's sub-directory only?
In git, is it possible to clone or checkout just a subdirectory, into the current directory? In svn, you would do this by extending the URL. For example, instead of checking out http://server/repo
you would checkout http://server/repo/subdir
The difference between sparse checkout and checking out only a subdir, is that a sparse checkout still creates a local directory subdir
. I don't want a subdirectory called subdir
. I want the contents of subdir
to be checked out into the top level of my working copy.
An example use case would be:
- I clone https://github.com/jquerytools/www.git
- I don't like their
css
so I do a sparse checkout or use ignores to exclude theircss
from my checkout. - I want to use the
source/css
subdirectory from https://github.com/mozfr/www.git and it must appear in the localcss
directory