2

I have a very big web project with lots of pdf, images, php files. I imported files into svn as a single project. I am using svn shallow checkout to checkout part of sub tree, and then use branch, and tag etc from the working copy to save space and speed up checkout time.

I am wondering if this is possible with git. I read that git does not allow you to commit or branch after you do sparse checkout. Is this still true with the newer git releases?

surajz
  • 3,471
  • 3
  • 32
  • 38
  • See the similar post: http://stackoverflow.com/questions/600079/is-there-any-way-to-clone-a-git-repositorys-sub-directory-only – Jay Sullivan Jun 26 '12 at 22:18

1 Answers1

2

Using the following commands, I was able to check out just the Documentation/ directory from the git repository located at git://github.com/git/git.git:

git init
git remote add -f github-git git://github.com/git/git.git
git config core.sparsecheckout true
echo Documentation/ >> .git/info/sparse-checkout
git pull github-git master

The git documentation doesn't say anything about not being able to commit new changes, so it sounds like it should work fine. Indeed, I tested this and I can confirm that I was able to commit new changes after doing a sparse checkout.

(I'm using git version 1.7.0.4)

Community
  • 1
  • 1
Jay Sullivan
  • 17,332
  • 11
  • 62
  • 86
  • No, it did not work as expected. It is pulling all the content inside .git/object. I don't see much space saving using sparse checkout vs regular checkout. In svn I can do 'svn co file:///repos/proj/trunk/templates-1.0 templates-1.0 --depth immediates' and pull only the subtree that I am interested in without any additional cost. – surajz Jun 26 '12 at 20:18