CVS to git

From Flavio's wiki
Jump to: navigation, search

How to convert a CVS repository to git

First, cd into the working directory of the CVS repository you want to convert. You can also convert a CVS repository that you don't have checked out with the proper cvsps and git-cvsimport options: see the respective man pages.

You might want to run cvsps by hand:

$ cvsps -z 1800 -A > /tmp/cvsps.out

(note that the -A option does nothing if you don't have branches)

You might want to create an author-conv-file (see git-cvsimport manual):

$ vi ~/author-conv-file

Now it's time to run git-cvsimport:

$ git-cvsimport -v -i -k -u \
  -C /tmp/repository.git \
  -A ~/author-conv-file \
  -P /tmp/cvsps.out

(if you didn't run cvsps by hand, remove "-P /tmp/cvsps.out")

  • "-v" is because I'm paranoid;
  • "-i" is useful if you're going to use this as a central repository with git-daemon and/or gitweb;
  • "-k" makes the changesets smaller (see git-cvsimport manual);
  • "-u" is generally a good idea because CVS tags don't accept dots and it's customary to use tags like "foo-1_2" (at least I do).

Misc git documentation