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:
-
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. -
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? -
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.
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 <fullname@provider.com>Now run these commands:
git-svn init url.to.svn.repository --no-metadatagit config svn.authorsfile ~/Desktop/users.txtgit-svn fetchThe 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.