I think the closest equivalent to svn export would be git archive. You could pull the directory path/to/module
from the master branch of a repository and put in the local directory module-name
like this:
git archive --remote=url-of-Git-repository --prefix=module-name/ master:path/to/module |
tar xf -
If the remote server does not support archiving, then pull the archive from a local (bare) clone (using a bare clone avoids having another copy of the files in the local repository, if that is important).
However, your use of “check out” implies (to me) that you want to have a functional Git work tree with only some of the files present. One can accomplish this with the “sparse checkout” functionality introduced in Git 1.7.0.
Enable this functionality by
- setting the core.sparseCheckout configuration option to “true”*, and
filling in the per-repository $GIT_DIR/info/sparse-checkout
file with the patterns for the pathnames to keep**.
One might use the the low level “skip-worktree bit” in the index*** to manage the sparseness of individual files, but it is probably easier to use the higher level mechanism instead.
There are some gaps in the overall user interface (i.e. there is no easy way say “clone the repository at this URL but only checkout X, Y, and Z”), but it should be enough to get “partial checkout” functionality.
* see “core.sparseCheckout” in the git config manpage
** see “Sparse checkout” in the git read-tree manpage
*** see “Skip-worktree bit” in the git update-index manpage