[ACCEPTED]-Is there a migration tool from CVS to Git?-cvs

Accepted answer
Score: 32

The only tool that has incremental import seems to 5 be git-cvsimport. If you want to convert (migrate) from CVS 4 to Git, the best solution for now seems 3 to be mentioned above cvs2git mode of cvs2svn.

See also Interfaces Frontends And Tools page on 2 Git wiki, section about interaction with 1 other revision control systems.

Score: 18


In addition to provided answers, here's 16 a guide on how to convert cvs to git using 15 cvs2git tool. Here, modulename is a name 14 of CVS directory you want to import.


cvs2svn package 13 (which includes cvs2git command) should 12 be already installed.

Update: steps 1 and 2 are 11 not fully correct - before attempting, read 10 the comment below by mhagger, the maintainer 9 of cvs2git

  1. checkout modulename

    cvs -d URL co -P modulename
  2. create an empty 8 CVSROOT needed by cvs2git

    mkdir modulename/CVSROOT
  3. download an example 7 of cvs2git.options at http://cvs2svn.tigris.org/svn/cvs2svn/trunk/cvs2git-example.options (user "guest" with 6 no password)

  4. edit cvs2git.options file. Replace 5 r'test-data/main-cvsrepos' with 'modulename'. Edit 4 authors transforms.

    # edit this
    run_options.set_project(  r'modulename',
    # and this
        'jrandom' : ('J. Random', 'jrandom@example.com'),
        'mhagger' : 'Michael Haggerty <mhagger@alum.mit.edu>',
  5. run cvs2git to create 3 git temp files

    cvs2git  --options=cvs2git.options --fallback-encoding utf-8
  6. create git repository

    mkdir gitrepo && cd gitrepo && git init .
  7. import 2 from git temp files created by cvs2git

    cat ../cvs2git-tmp/git-{blob,dump}.dat | git fast-import
  8. checkout 1 working copy

    git reset --hard
Score: 13

cvs2svn has a cvs2git mode.


Score: 10

If anyone still has the misfortune of using 4 CVS, you could try "crap" : https://github.com/rcls/crap It's 3 fast (as far as accessing CVS can be fast), supports 2 the messes that you find in cvs repos, and 1 incremental.

Score: 7

An alternative might be to use git cvsimport *


Score: 6

I've not tried this myself, but friends 5 have reported good success converting first 4 from CVS to SVN, and then from SVN to Git. It 3 seems that the tools to do those respective 2 transitions have been more thoroughly shaken 1 out than a direct CVS to Git transition.

Score: 2

I've tried cvs2git, git-cvsimport and parsecvs.

cvs2git 21 sometimes (as far as I remember) creates 20 bogus branches for tags.

git-cvsimport does 19 not support multiple tags for a changeset. It 18 is possible however to grab some additional 17 changes for cvsps to support it and change 16 the original git-cvsimport to something 15 which uses updated cvsps (I've tried it 14 and it seems to work). On the advantage 13 side it supports incremental updates and 12 has some logic to properly import merges 11 (but it REQUIRES appropriate format for 10 commit message).

parsecvs so far gave me 9 the best results. Unfortunately the code 8 available on the web does not compile cleanly 7 with the latest git. The change while not 6 trivial is doable.

EDIT: It looks like ESR took 5 over both cvsps and parsecvs so there is some hope for 4 CVS->GIT migration. BUT he already mentioned 3 on some mailing list that he may declare 2 some of the tools he took over recently 1 officially dead.

Score: 2

I read the answer by Vanuan and mhagger's 11 comments to it. Unfortunately mhagger didn't 10 post how to do it with cvs2git. It is all very 9 well written up here: http://www.mcs.anl.gov/~jacob/cvs2svn/cvs2git.html

I used cvs2git instead of 8 git-cvsimport because the documentation of git-cvsimport suggests 7 to use it instead to avoid the problems 6 of git-cvsimport: https://www.kernel.org/pub/software/scm/git/docs/git-cvsimport.html#issues

It follows essence of it that worked 5 for me to create a git repository from a 4 sourceforge CVS repository on Debian Sid:

$ apt-get install cvs2svn cvs
$ mkdir project.cvs
$ rsync -av rsync://${PROJECT}.cvs.sourceforge.net/cvsroot/${PROJECT}/ project.cvs
$ cvs2git --blobfile=git-blob.dat --dumpfile=git-dump.dat --username=cvs2git project.cvs
$ mkdir project.git
$ cd project.git
$ git init
$ cat ../git-blob.dat ../git-dump.dat | git fast-import

The 3 rsync step is needed because cvs2git needs access to 2 the whole history. A simple checkout is 1 not enough.

Score: 2

I'm the maintainer of cvs-fast-export. I 14 used to maintain cvsps and parse2cvs and 13 have closely evaluated cvs-fastimport and 12 cvs2git.

CVS to git conversion is a hard, nasty 11 problem with rebarbative edge cases. All 10 the existing conversion tools have known 9 limitations, some quite serious.

I recommend 8 trying cvs-fast-export first. It produces 7 better, faster conversions than anything 6 else, except in rare cases where it fails 5 cleanly and bails out. If you get the rare 4 but dreaded "branch cycle error", try 3 cvs2git.

Do not trust cvs-fastimport, it 2 is quite buggy and often screws up branch 1 joins.

For more, see http://www.catb.org/esr/cvs-fast-export/

Score: 1

You can add fromcvs to the list. It converts well 2 and is extremely fast and also incremental. It 1 does not do sticky tags, only branches, however.

Score: 1

You can use git cvsimport. It requires cvsps to be installed, but 15 you need to install 2.x, as 3.x is not incompatible anymore.

Then 14 import CVS repository on empty git. Sample 13 usage:

git cvsimport -C RepoName -r cvs -o master -k -v -d:pserver:anonymous@reponame.cvs.sourceforge.net:/cvsroot/path ModuleName

On OSX you install cvsps-2.1 in the following 12 way (having brew):

brew tap homebrew/versions
brew install cvsps2
brew link  cvsps2

You can also use cvs2git tool which 11 can convert a CVS repository to git. However 10 you need to have access to a CVSROOT directory.

Check 9 cvs2git documentation for installation steps.

Example usage:

cvs2git --blobfile=git-blob.dat --dumpfile=git-dump.dat --username=cvs2git /path/to/cvs/repo

This 8 would create two output files in git fast-import 7 format. The names of these files are specified 6 by your options file or command-line arguments. In 5 the example, these files are named cvs2git-tmp/git-blob.dat and 4 cvs2git-tmp/git-dump.dat.

These files can be imported into empty 3 git repository by:

cat git-blob.dat git-dump.dat | git fast-import

Then delete the TAG.FIXUP branch 2 and run gitk --all to view the results of the conversion.

Check 1 for more, by running: cvs2git --help.

Score: 0

I found cvs-fast-export did an excellent job. I had to 2 download and compile it myself, but didn't 1 have any significant issues doing so.

More Related questions