I've accidentally cloned a Subversion repository without adding the --stdlayout argument, giving me something like:
$ git svn clone --prefix=svn/ svn+ssh://code.example.com/project
[two weeks later]
$ git branch -a
* master
remotes/svn/git-svn
With the svn/git-svn layout being something like:
branches/*
tags/*
trunk/*
Any way to recover from this?
Migrate from SVN to Git with History and Branches You will now need to edit each author in the author-transformed. txt file to match the syntax you need for your Git author information. Now that you have your list of authors ready, you can run the import using git svn and specify the authors-transform. txt .
That depends: do you want to be able to interoperate with subversion in the future?
If not, consider manually creating a branch in git for each branch in branches
and moving the contents of that branch directory up to the top level. That gives you a commit to work from, and git's rename tracking should mean that looking at the history works reasonably well. If you want tags, you could similarly create a branch for each tag, tag it, then delete the branch.
This isn't pretty, but it should be workable.
More work would be to use git filter-branch
to re-write the history of each of the branches you've just created in the same way that you re-wrote the tip. This should leave you with a repository that looks correct. You still wouldn't get subversion integration, though, and you'd have to work out how to deal with the original branch point.
Much, much more work would be to work out how git svn
stores its metadata and transform the repository (probably again using git filter-branch
) accordingly -- all the data should be there :).
Currently, it looks like a fresh start is the only option which will maintain interoperability with SVN.
It's not an exact answer, but what I did was add the -r
flag to just specify the last few commits, since I didn't really want commits from a year ago anyway.
git svn clone --prefix=svn/ -s -r12000:HEAD http://some/svn/repo
This requires that you know what rev number you want to go back to, in this case, 12000. It allowed me to keep my sanity after missing the -s
flag and did what I really wanted to do in the first place in a reasonable amount of time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With