Best practices for using git with CVS

I wrote up an answer to a similar question here.

This works suprisingly well when you're forced to continue to push changes into a central CVS repository.


I've only worked with Git-CVS interactions to demo Git for a friend, but it was very straightforward.

  • You need to install a current copy of cvsps. Git cvsimport uses this to access CVS history.
  • We found that, for a large project, inital set-up was much faster by taking a full copy of the CVS repo onto your computer, and doing the git cvsimport locally:

    $ rsync rsync://yourprojecthost.com/cvsroot/yourproject/*  
    $ mkdir myproject.git  
    $ cd myproject.git  
    $ git cvsimport -p -x -v -d :local:/path/to/cvsroot/yourproject 
    

Note that the -x after -p is very important. This passes -x to cvsps. For more information please see the cvsps man page.


I wrote up the details of my own workflow for remote CVS, local Git


Slightly meta-answer. If you are forced to use git 'guerilla style', i.e. your company is stuck using cvs for the version control and you use git on your workstation to make life easier, you might consider doing something like this;

CVS=realCvsPath
# commit to the git first
if ($ARGV[0] && $ARGV[0] eq "commit")
{
system 'git commit -a';
}

# execute the appropriate cvs program
# ===================================
exec "$CVS", @ARGV

Calling this file 'cvs' and including it the path before the real CVS command. Otherwise you can have git commits older than the cvs ones, which isn't that useful...