Cloning only a subdirectory with git
Cf https://www.kernel.org/pub/software/scm/git/docs/git-archive.html
With a shell command :
git archive --remote=<repo_url> <branch> <path> | tar xvf -
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
.