2

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 ?

1

1 Answer 1

2

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.

2
  • Doing this creates the Folder B folder (ex www/Folder B/~files) I only want the contents of folder B to be pulled (www/~files). May 26, 2015 at 9:26
  • 1
    @MariusIlie then checkout it somewhere else, and set www as a symlink to folder B
    – VonC
    May 26, 2015 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.