Skip to content

Cleanly import svn repository into git

There are quite a few blog posts about how to import a Subversion repository into git.  Simplistic Complexity’s write-up is the best I’ve seen on how to do it cleanly.  Here is a quick summary of the steps:

mkdir temp_repos; cd temp_repos

# init the git repository, do not import quite yet
git-svn init svn://repository_goes_here

# specify mapping from svn users to git users
git config svn.authorsfile ~/authors.txt

# start the import, it may take a while
git-svn fetch

cd ..; git clone temp_repos clean_repos
rm -rf temp_repos; cd clean_repos
# enjoy working with git

If you would like more detail, especially about the mapping of users with authors.txt, please refer to the original article.

8 Comments

  1. click170 wrote:

    Did you completely forget that you have to apt-get install git-svn or did you just intentionally leave that out?
    How about putting some attention into your blog posts and being thorough, makes for a less frustrating read when someone’s trying to follow your half-ass instructions and you’ve entirely missed a step.

    Tuesday, October 20, 2009 at 3:01 pm | Permalink
  2. David wrote:

    click170: Good point: if you don’t have a piece of software, you do indeed need to install it before you can use it for fun and profit. You do realize, however, that not everyone uses apt-get?

    Wednesday, October 21, 2009 at 4:11 pm | Permalink
  3. Jeremy wrote:

    click170 is right, David. You completely leave out how the Subversion repository was setup, the OS-specific instructions for installing Subversion, and the instructions for installing the OS on my machine. Please stop writing half-assed blog posts.

    Wednesday, October 21, 2009 at 4:15 pm | Permalink
  4. James wrote:

    do i need a computer for this? where can I get one?

    Wednesday, October 21, 2009 at 5:18 pm | Permalink
  5. Bob wrote:

    seriously what the hell.
    ever tried “git help” ? you will probably find that the 170 different commands mostly merged from “git-something” into “git something”.

    Do i need 0.02 $ for this? where do i get those?

    Saturday, November 7, 2009 at 1:20 pm | Permalink
  6. neill wrote:

    Well ignoring Click170 and Jeremy completely (seriously – take a bit of responsibility guys for educating yourselves. He didn’t mention you needed linux either – or git – or several other steps like knowing how to use bash). Just to say thanks for this – I’d spent quite a long time trying to get git-svnimport to work and couldn’t – this worked like a charm! Thanks!

    Monday, March 8, 2010 at 7:12 pm | Permalink
  7. neill wrote:

    Ignore the Jeremy bit on the last post – but keep Click170 on (sorry Jeremy – read your post too quickly!)

    Monday, March 8, 2010 at 7:14 pm | Permalink
  8. Jeremy wrote:

    This does not work on my iPad. YOU WRITE TERRIBLE BLOG POSTS!

    Monday, April 5, 2010 at 12:44 pm | Permalink

One Trackback/Pingback

  1. Git Cheat Sheet – Matt Rude on Saturday, March 20, 2010 at 1:08 pm

    [...] http://djwonk.com/blog/2008/05/09/cleanly-import-svn-repository-into-git/ [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*