views:

81

answers:

3

I have a lot of pre-existing projects and code in a few different Subversion repositories. I am planning on getting my toes wet with Git by migrating a few of the easier/soon to be multi-developer projects to Git. I have a few questions:

  1. If I start with a hosted Git solution, is it hard to change the Git server of a project (In Subversion, you simply have to change the URL, etc)? I would do this to get up and running and comfortable with Git before installing and maintaining my own server locally.

  2. What are some good steps to follow to migrate my data from Subversion to Git? Will I have to check out every revision from SVN, export, and commit to Git to get the history?

  3. Any gotchas that you've experienced?

A few reasons for the change: We do a LOT of branching and merging, we will be adding a few developers on these projects, we will have developers not always in the office/on the network/etc.

+2  A: 

Hi, firstly I would recomend book Pro Git

  1. It's not difficult at all. You can do somethink like

    git remote add

and you can have more remotes at the same time and fetch changes from your coworkers to different branches before you merge them and push to the server.

  1. I have no experiences with more branches in svn but for me was enaugh to do something like

    git svn clone svn-repo

pejuko
A: 

1) It's trivial. Git is distributed.

2) There's many guides out there if you google, but the basic sequence is git svn clone, then convert all svn tag branches to real git tags, delete the tag branches, then add a git remote and push.

3) Nothing major.

I highly recommend going with GitHub for your host. They have private repos that are not expensive and their site is superb.

Daenyth
+2  A: 

1. it is actually very easy to change the server since you clone the entire repository on your computer then you just push it to the new server;

2. you can use git-svn to clone the svn repository in a new git repository preserving the history. First you need to create a users file that maps all your SVN users to your GIT users. Make a file on your Desktop named ‘users.txt’. Map the users using this format:

username = Full Name <[email protected]>

Now run these commands:

git-svn init url.to.svn.repository --no-metadata
git config svn.authorsfile ~/Desktop/users.txt
git-svn fetch

The first command initializes the directory as a git-svn hybrid and points the origin at your svn repository. The flag, --no-metadata, tells git to leave all the svn details behind (not the commit log). The next command tells git to remap all the svn users to git users. The last command actually does the fetching.

Igor Popov
+1 This is quite helpful and detailed! Thank you very much.
manyxcxi