Monday, July 11, 2011

Git: Migrating from CVS

There is a git-cvsimport utility that may migrate CVS repository to Git Repository.  However, this utility is buggy and doesn’t export the CVS properly especially there are branches in the repository.  A more mature tools to use is cvs2svn. Do not confuse with the name it implied that it is CVS to SVN tool.  In fact, it contain a cvs2git utility to convert CVS repository to Git.


Using git-cvsimport is not recommended.  If you insist to use, here are some simple usage.

Install git-cvsimport utility:

# apt-get install git-cvs
To import a  CVS repository to Git, try this
# git-cvsimport -v –d <CVSROOT> –C <git.repo> <cvs-repository>

The CVSROOT may be a CVS folder that has CVSROOT folder or a CVS protocol URL.


Download and install cvs2svn.

Use this command create a blob file and a dump file for next stage:

# cvs2svn-2.3.0/cvs2git --blobfile=git-blob.dat --dumpfile=git-dump.dat --username=cvs2git <cvs-repository>

The cvs-repository should be direct filesystem CVS repository.  CVS protocol URL is not allow here.

Create a Git repository:

# git init --bared --shared import.git
# cd import.git
Import the blob and dump files to git repository:
# cat ../git-blob.dat ../git-dump.dat | git fast-import

No comments: