Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does git-svn behave with svn repositories that have changed layout?

This question is similar to this one and this one, but the scenario is slightly more complex.

I started out a few years ago with a private svn repository (which I use mainly for shared config files and the like between various machines). I wasn't too careful with the layout of the repository (where branches, go, etc.), so it changed quite a lot over time. This was, of course, a mistake, but it's too late now. More recently, I've migrated it to a more standard svn trunk/branches/tags layout, mainly with svn move commands, but of course the old history is still present in the repository (and is, frankly, a bit of a mess).

I'd now like to convert this permanently to a git repository. I've tried using git-svn, but it only seems to handle situations where a consistent trunk/branch/tag convention has been followed (yes, you can provide alternative names, but only one for each, it appears). Quite a lot of the history of my repository has trunk effectively in the root of the repository, for example, with tags/ and branches/ as sub-dirs.

What's the best way to handle all of this? Ideally I'd like the git repository I end up with to at least have all the history accessible in some way, even if the branches and tags aren't properly represented as first-class concepts in git.

More specifically, how will svn-git handle files outside the trunk/branches/tags subdirectories it's provided with? My observations so far are that it misses them out sometimes (definitely not OK), and other times adds them to the new repository.

Any thoughts would be appreciated.

like image 984
Andrew Ferrier Avatar asked Jul 20 '09 13:07

Andrew Ferrier


People also ask

How does Git SVN work?

git svn is a git command that allows using git to interact with Subversion repositories. git svn is part of git, meaning that is NOT a plugin but actually bundled with your git installation. SourceTree also happens to support this command so you can use it with your usual workflow.

What is the difference between Git and SVN repository?

The difference between Git and SVN version control systems is that Git is a distributed version control system, whereas SVN is a centralized version control system. Git uses multiple repositories including a centralized repository and server, as well as some local repositories.


1 Answers

In my experience, the only way to handle this is to track the repository's location throughout time, and make a separate git-svn-clone for each period the project remained in one location.

After you've created the repositories for different stages in time (or at least as far back as you can be bothered), you can graft the repositories together.

I've created a screencast demonstrating this technique here:

http://blog.tfnico.com/2010/10/gitsvn-6-grafting-together-svn-history.html

like image 143
Thomas Ferris Nicolaisen Avatar answered Oct 06 '22 01:10

Thomas Ferris Nicolaisen