Reputation: 220
I have been trying this with no success.
I have a git repository that contains 3 folders. Lets say:
Folder A Folder B Folder C
I want to be able to pull just the contents of folder B to a webserver for example.
I just want to somehow init a git repo on the www folder for example and do some magic and have the files in Folder B pulled to this particular folder.
Doing a sparse-checkout on folder B creates folder B in my www folder. I just need the contents of it.
Is this even posible with Git ?
Upvotes: 2
Views: 1112
Reputation: 1328122
You can try a sparse checkout in order to load only the folder B.
git init <repo>
cd <repo>
git remote add -f origin <url>
git config core.sparseCheckout true
echo "Folder/B/" >> .git/info/sparse-checkout
git pull origin master
See "Is there any way to clone a git repository's sub-directory only?"
Since a sparse checkout does create a folder, you need to checkout it somewhere else, and make sure www
is symlinked to that folder.
Upvotes: 2