~ 1 min read

Import SVN Repository to Git

To import an SVN repository into git, you can use the git svn command.

If you want to just import your SVN repository into Git as is, you can run the following sequence of commands:

$ git svn clone SVN_REPO_URL LOCAL_DIR
$ cd LOCAL_DIR
$ git remote add origin [email protected]:USER_NAME/REPO_NAME.git
$ git push origin master

If you repository is setup in a standard way and you want the git svn command to be smart about it, you should add the -s flag to the first command:

$ git svn clone -s SVN_REPO_URL LOCAL_DIR
$ cd LOCAL_DIR
$ git remote add origin [email protected]:USER_NAME/REPO_NAME.git
$ git push origin master

Which basically says to git svn that your repository is in a standard layout.