Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


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
  • edit repo/.git/config adding /foo to relevant paths (or /bar)


[svn-remote "svn"]
   url =
   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
  • 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.

share|improve this question
You have done it. You just forgot to check out the latest revision; git svn fetch does not do that. – Jan Hudec Jan 23 '13 at 9:00
up vote 2 down vote accepted

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.

share|improve this answer
Doh! That was it. git reset trunk did it! git svn rebase failed with an error I have since forgotten. – Cameron Tacklind Jan 24 '13 at 1:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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