Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

svn vs git shallow (sparse) checkout - branching, commit

Tags:

git

svn

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?

like image 515
surajz Avatar asked Mar 26 '26 01:03

surajz


1 Answers

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)

like image 135
Jay Sullivan Avatar answered Mar 28 '26 19:03

Jay Sullivan