なぜこれを行う必要があるのか について詳しく説明することなく、問題は(おそらく)シンボリックリンク/ショートカットによって簡単に解決できます。
To answer the question - no, and with a meaningful reason. The whole history of the repo is downloaded even with a 'sparse checkout'. To clarify why this is necessary - otherwise tracking renamed files would be a pain in the ...neck. Imagine you move the file /repo_root/asd/file1.cpp
to /repo_root/fgh/file1.cpp
- now if you had only downloaded /repo_root/fgh
deltas, you won't know about file1.cpp. So this means you must download all deltas. But then you have a full repository; not just a folder cut of it, therefore just the /rero_root/fgh
folder is not a repo itself. This might not sound important when you checkout, but when you commit, git might not know enough to work alright.
Workaround: If you really want to, you can create a script that calls git-checkout in such a manner (for the sh shell, batch for windows should not be hard to produce):
!/bin/sh
curDir=`pwd`
cd $2
git-checkout $1
cp -R $3/* $4
cd $curDir
Here the first argument is the branch to checkout, the second - the folder where the repo is currently present, the third - the subdir you want to really use, and the fourth - the location to which you want it copied.
Warning: my shell skills are almost non-existent, so use this after testing. It should not be hard to recreate the reverse of this script, that copies back stuff, so that it can be committed to the repo.