A while ago I wrote about how to import an existing SVN repository to GitHub. The approach I used there describes how to import a folder with its full revision history. That however may not be needed or wanted in a lot of scenarios(for example - the SVN repository being too old). In that case we could do a partial import – import the changes made in the last year or a couple of months or the last “x” revisions of the SVN.
In that case we must do a couple of things:
- We must decide from which revision number on we want to import the history. You could check the revision numbers and dates in the “Show Log” option in TortoiseSVN or a similar one depending on the SVN software you use. We’ll call the revision number BeginNum.
- We must find the latest revision number. We’ll call it EndNum.
- We must change the “svn clone” command we used in my previous post adding a “–r “ option:
git svn clone –r BeginNum:EndNum –A <path-to-users.txt> <SVN-path-to-clone>
And that is it! Git will now import all the revisions beginning from revision number BeginNum to revision number EndNum without the ones before BeginNum.