I have a git repository that includes subdirectories. Example dirA/dirB.
Is there any way to do a git clone
on a Unix server to pull only files from a subdirectory (dirB)?
Is there some other git command other than clone that will do this?
How do I git a specific file?
Suppose your project is in a dir called project
, and you want only those commits which touch project/dirB
.
Then:
git clone project/ subproject/
cd subproject
git filter-branch --prune-empty --subdirectory-filter dirB HEAD
subproject
will now contain the git history which touches dirB
.