How do I clone a subdirectory only of a Git repository

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I have my Git repository which, at the root, has two sub directories:

/finisht
/static

http://en.wikipedia.org/wiki/Apache_Subversion http://en.wikipedia.org/wiki/Apache_Subversion

svn co svn+ssh://admin@domain.com/home/admin/repos/finisht/static static

Is there a way to do this with Git?

Answers

http://stackoverflow.com/a/13738951/278405 http://stackoverflow.com/a/13738951/278405

"Sparse checkout" allows populating the working directory sparsely. It uses the skip-worktree bit (see git-update-index) to tell Git whether a file in the working directory is worth looking at. While $GIT_DIR/info/sparse-checkout is usually used to specify what files are in, you can also specify what files are not in, using negate patterns. For example, to remove the file unwanted:
/*
!unwanted

https://git-scm.com/docs/git-read-tree#_sparse_checkout https://git-scm.com/docs/git-read-tree#_sparse_checkout

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils