Problem
How do you create a shallow copy with git-svn from a Subversion repository, e.g. how do you pull only the last three revisions?
The git clone
command can get the last n revisions from a Git repository if you use the option --depth
, i.e. you get a shallow copy of the repository. Example:
git clone --depth 3 git://some/repo myshallowcopyrepo
Is there a similar option for git-svn?
My discoveries so far
So far I've only found the -rN
option where N
is the revision to pull. Example:
git svn clone -rN svn://some/repo
According to the documentation there is the possibility to use -r$REVNUMBER:HEAD
. I tried the following to get the last 3 revisions which returned an error message.
$ git svn clone --prefix=svn/ -s -rHEAD~3:HEAD http://some/svn/repo .
revision argument: HEAD~3:HEAD not understood by git-svn
So I replaced HEAD~3
with the actual number of the third but last revision 534. That worked, but that requires me to first figure out the revision number of the third but last commit.
$ git svn clone --prefix=svn/ -s -r534:HEAD http://some/svn/repo .
Documentation
-s is for --stdlayout which presumes the svn recommended layout for tags, trunk, and branches.
(but didn't work for me) – Sebastián Grignoli--depth
forgit svn
, since the support is already there. And it already has to find out the latest rev from the server? – Peter Cordes