The git usage is very widespread among the developers! Through the use of the public or private repository is possible to store code, track versions and share and collaborate with teammate and/or entire communities.

But every repository may contain docs, examples or other files near the needed application. When it’s time to build an application which is composed of files contained in many libraries, the need to “purge” code from unnecessary files become mandatory. In the same way, the continuous pull of dependent libraries could depend on the release of the application.

Git can pull a directory contained in a sub-repository simply enabling “sparseCheckout” config in the root Repository.

mkdir localrepo
cd localrepo
git init
git remote add -f origin [url repository]

Then enable “sparseCheckout” option

git config core.sparseCheckout true

Every directory is needed in local repo must be indicated “spare-checkout” file under .git/info directory

echo "lib/" >> .git/info/sparse-checkout
echo "lib/dummy/" >> .git/info/sparse-checkout

Next issue a simple git pull.

git pull origin master

Enjoy

By admin

Utilizzando il sito, accetti l'utilizzo dei cookie da parte nostra. Using this site you accept cooking utilization. maggiori informazioni more Informations

Questo sito utilizza i cookie per fornire la migliore esperienza di navigazione possibile. Continuando a utilizzare questo sito senza modificare le impostazioni dei cookie o cliccando su "Accetta" permetti il loro utilizzo. This site uses cookies to provide the best browsing experience possible. By continuing to use this website without changing your cookie settings or clicking "Accept" allow their use.

Chiudi Close