Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to git-svn clone the last n revisions from a Subversion repository?
    primarykey
    data
    text
    <p><strong>Problem</strong></p> <p>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?</p> <p>The <code>git clone</code> command can get the last n revisions from a Git repository if you use the option <code>--depth</code>, i.e. you get a shallow copy of the repository. Example:</p> <pre><code>git clone --depth 3 git://some/repo myshallowcopyrepo </code></pre> <p>Is there a similar option for git-svn?</p> <p><strong>My discoveries so far</strong></p> <p>So far I've only found the <code>-rN</code> option where <code>N</code> is the revision to pull. Example:</p> <pre><code>git svn clone -rN svn://some/repo </code></pre> <p>According to the documentation there is the possibility to use <code>-r$REVNUMBER:HEAD</code>. I tried the following to get the last 3 revisions which returned an error message.</p> <pre><code>$ git svn clone --prefix=svn/ -s -rHEAD~3:HEAD http://some/svn/repo . revision argument: HEAD~3:HEAD not understood by git-svn </code></pre> <p>So I replaced <code>HEAD~3</code> 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.</p> <pre><code>$ git svn clone --prefix=svn/ -s -r534:HEAD http://some/svn/repo . </code></pre> <p><strong>Documentation</strong></p> <p><a href="http://git-scm.com/docs/git-clone" rel="noreferrer">git-clone</a></p> <p><a href="http://git-scm.com/docs/git-svn" rel="noreferrer">git-svn</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload