git notes main page | gitolite main page | license

IMPORTANT NOTE: although this page has a "gitolite.com" URL, this is not about gitolite. That's just an artifact of "sitaramc.github.com" being translated to "gitolite.com" and so ALL my git related stuff gets carried over. Gitolite documentation has another /gitolite in the URL, so you can tell. My apologies for this confusion.

converting CVS to git

Update 2009-10-08: It has been pointed out that cvsimport, which I recommend against using below, can do incremental imports. If this is important to you (it wasn’t, to me, and it never will be), then this document is probably no use to you. Sorry…


First: do NOT use the builtin git cvsimport unless your repository is very simple and linear. Problems I had using it on a moderately complex repo include missing tags, branches grafted to the wrong place (by comparing with a --simplify-by-decoration tree later), missing commits (which is what originally made me start investigating), and even missing files in the root of the repo!!

It’s been too long since I last used CVS to figure this out, and cvs2svn seemed to deal with a lot more nuances, so I used that instead.

1 step 1 – make a dump file

2 step 2 – import into git

3 Appendix

These are the changes I made to the options file:

diff --git 1/test-data/main-cvsrepos/cvs2svn-git-inline.options 2/my.c2soptions.inline
index 635f9cd..a5a4018 100644
--- 1/test-data/main-cvsrepos/cvs2svn-git-inline.options
+++ 2/my.c2soptions.inline
@@ -39,7 +39,7 @@ ctx.cross_branch_commits = False
 # record the original author (for example, the creation of a branch).
 # This should be a simple (unix-style) username, but it can be
 # translated into a git-style name by the author_transforms map.
-ctx.username = 'cvs2svn'
+ctx.username = 'someone'

 # CVS uses unix login names as author names whereas git requires
 # author names to be of the form "foo <bar>".  The default is to set
@@ -59,7 +59,7 @@ author_transforms={

     # This one will be used for commits for which CVS doesn't record
     # the original author, as explained above.
-    'cvs2svn' : ('cvs2svn', 'admin@example.com'),
+    'someone' : ('someone', 'someone@my.company.com'),
     }

 # This is the main option that causes cvs2svn to output to git rather
@@ -115,7 +115,7 @@ run_options.add_project(
     # The path to the part of the CVS repository (*not* a CVS working
     # copy) that should be converted.  This may be a subdirectory
     # (i.e., a module) within a larger CVS repository.
-    r'test-data/main-cvsrepos',
+    r'../cvsroot/myproj',

     # See cvs2svn-example.options for more documention about symbol
     # transforms that can be set using this option.