Yuriy Markiv blog

TECH

pull git/bitbucket repository partially

09 December, 2018 | tech

Console steps:

cd ~/git/
mkdir partial_test
cd partial_test/
git init
git remote add -f origin https://user:password@git.example.com/folder1/repository1.git
git config core.sparseCheckout true
echo "subfolder1/subfolder2/needed_folder/" >> .git/info/sparse-checkout
git pull origin master

(tested in ubuntu 16.04.5 LTS, git 2.7.4)