I want to clone an svn repo with git-svn. The problem is the subversion repository changed layouts at r1235.


From revision 1 to 1234, foo used the standard svn folder layout with:

  • /trunk/src
  • /tags/version/src

At revision 1235, the author added bar to the repo. To do so they restructured the master repository making the folder layout look like this:

  • /trunk/foo/src
  • /trunk/bar/src
  • /tags/version/foo/src
  • /tags/version/bar/src


I want a new git repository that has the history of foo as if it was never rearranged to include bar.

Relevant Documentation

Working with non standard layouts is discussed in git-svn's documentation.

If the entire history in unnecessary (or if I just want bar), I can get what I want from r1235 on:

  • git svn init --stdlayout http://path.to/repo
  • edit repo/.git/config adding /foo to relevant paths (or /bar)


[svn-remote "svn"]
   url = http://path.to/repo
   fetch = trunk/foo:refs/remotes/trunk
   branches = branches/*/foo:refs/remotes/*
   tags = tags/*/foo:refs/remotes/tags/*


  • git svn fetch -r 1235:HEAD

My attempts

  • git svn clone -r 1:1234 --stdlayout http://path.to/repo
  • edit repo/.git/config as above
  • git svn fetch -r 1235:HEAD


The last command seems to succeed because r1235 - HEAD get downloaded. However, git log only shows commits up to 1234. The working directory also seems to be the old revision.

  • 2
    You have done it. You just forgot to check out the latest revision; git svn fetch does not do that.
    – Jan Hudec
    Jan 23, 2013 at 9:00

1 Answer 1


You did just git svn fetch, so you now have to check out the latest revision.

Any of git svn rebase (hm, I am least certain with this one after the path change, but normally it's what you use; it includes fetch), git reset --hard trunk (forcibly discards local changes), git rebase trunk (re-applies committed local changes) or git merge --ff-only trunk (check there are no local changes) should do and since you don't have local changes yet are equivalent.

  • Doh! That was it. git reset trunk did it! git svn rebase failed with an error I have since forgotten. Jan 24, 2013 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.