How to pull specific directory with git
- cd into the top of your repo copy
git fetch
git checkout HEAD path/to/your/dir/or/file
Where "
path/...
" in (3) starts at the directory just below the repo root containing your ".../file
"NOTE that instead of "HEAD", the hash code of a specific commit may be used, and then you will get the revision (file) or revisions (dir) specific to that commit.
After much looking for an answer, not finding, giving up, trying again and so on, I finally found a solution to this in another SO thread:
How to git-pull all but one folder
To copy-paste what's there:
git initgit remote add -f origin <url>git config core.sparsecheckout trueecho <dir1>/ >> .git/info/sparse-checkoutecho <dir2>/ >> .git/info/sparse-checkoutecho <dir3>/ >> .git/info/sparse-checkoutgit pull origin master
To do what OP wants (work on only one dir), just add that one dir to .git/info/sparse-checkout
, when doing the steps above.
Many many thanks to @cforbish !