/ Git

Git SVN Clone Since Specific Revision or Latest Revision

If you have a project that uses SVN and already has so many revisions there, cloning it as git repository could take a lot of time, because all of the revisions will be downloaded.

The best practice would be only clone revisions that you need. For example, we only need to get the project since revision r1020 until the last one, we can do something like this.

$ git svn clone -r1020:HEAD http://repo.com/svn/path/to/myproject project

or

$ mkdir project
$ git svn init http://repo.com/svn/path/to/myproject
$ git svn fetch -r1020:HEAD

By using the technique above, we can save up a lot of time and storage.

See on the -r1020:HEAD, it should not contains space between -r and the revision number. Don't write it as -r 1020:HEAD because it's invalid.

Also, it's possible to clone the latest revision only, by using -rHEAD.

$ git svn clone -rHEAD http://repo.com/svn/path/to/myproject project
Git SVN Clone Since Specific Revision or Latest Revision
Share this