Git sparse checkout

From Tech
Jump to: navigation, search

The sparse checkout for git is new with version 1.7.0. It can be used to hide all but specified folders. In order to use it, you must first specify that you want to use it, then specify which folders should be visible. This is different than what you can do with svn because you must still show the full path leading to any files that are visible.

git clone ... (if necessary, and go into your git repository)
git config core.sparsecheckout true
echo folder1 > .git/info/sparse-checkout
echo folder2/subfolder >> .git/info/sparse-checkout
git read-tree -m -u HEAD

You will notice that the root folder only shows folder1 and folder2, and that folder2 only shows subfolder.

Personal tools