werty1st
9/17/2013 - 12:03 PM

git sparse checkout

git sparse checkout

What you are trying to do is called a sparse checkout, and that feature was added in git 1.7.0 (Feb. 2012). The steps to do a sparse clone are as follows:

git init <repo>
cd <repo>
git remote add -f origin <url>
This creates an empty repository with your remote. Then do:

git config core.sparsecheckout true
Now you need to define which files/folders you want to actually check out. This is done by listing them in .git/info/sparse-checkout, eg:

echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
Last but not least, update your empty repo with the state from the remote:

git pull origin master

damit man später git pull ohne origin master machen kann muss man das noch in ie .git/config eintragen
[branch "master"]
    remote = origin
    merge = refs/heads/master