Git how to check only a folder – Sparse checkout

Since git 1.7.0 it is possible to use a technique called the sparse checkout

The steps for clones are:

Mkdir<repo></repo>
Cd<repo></repo>
git init
git remote add -f origin<url></url>

This creates an empty folder, the fetches but without checking them. Then you have to set up to use sparseCheckout.

git config core.sparseCheckout true

Then you have to define which folders/files will have to. To do this you have to add them in the file .git/info/sparse-checkout. Like what:

echo "some/dir/" .git/info/sparse-checkout
echo "another/sub/tree" - .git/info/sparse-checkout
Publicités

Once this is done, you have to update the file:

git sweater origin master

sparse checkout documentation.

Publicités

Leave a Reply