Reputation: 31
I have been able to clone only a subdirectory of a git repository using sparse:
git init <repo>
cd <repo>
git remote add origin <url>
git config core.sparsecheckout true
echo "DEPLOY/*" >> .git/info/sparse-checkout
git pull --depth=1 origin master
Now, I would like to clone only DEPLOY directory content, not the directory itself. Does exist any way to do that?
Upvotes: 2
Views: 80
Reputation: 2556
i also was not able to get sub-directory content.
the best for something similar problem was to jump easier into the subdir by using a symlink later
mkdir gitFullRepo; cd gitFullRepo;
git init;
git remote add -f origin [email protected]:repo/repo.git;
git config core.sparsecheckout true; echo "subDir/" >> .git/info/sparse-checkout;
git pull origin master;
cd ..;
ln -s ./gitFullRepo/subDir/ ./hereIWantWork;
Upvotes: 0
Reputation: 1323115
No, that would still be a sparsed checkout.
You would simply have to follow with a copy or a move of the DEPLOY
content to where you need it.
Upvotes: 1