Enable sparse checkout
git config --global core.sparseCheckout true
Initial the local repository
git init
git remote add origin <git-repo-url>
Edit “.git/info/sparse-checkout” to add the relative path of the directory. Example:
echo "some/dir/" >> .git/info/sparse-checkout
Pull corresponding branch. Example:
git pull origin master