Login | Register
My pages Projects Community openCollabNet




cvs2svn/cvs2git is a tool that can be used to migrate CVS repositories to newer version control tools, including git. git is a distributed version control system most famous for being used for Linux kernel development. The program used to convert to git, called cvs2git, is distributed as part of the cvs2svn project.

If you are reading this documentation on the cvs2svn website, then please be aware that it describes the current trunk version of cvs2svn, which may be different than the most recent released version. Please refer to the documentation that was included with your version of cvs2svn.

Conversion to git was added in release 2.1 of cvs2svn and has improved significantly since then. Please make sure you are using an up-to-date version of cvs2svn--perhaps even the development trunk version.


cvs2git requires the following:

  • Direct (filesystem) access to a copy of the CVS repository that you want to convert. cvs2git parses the files in the CVS repository directly, so it is not enough to have remote CVS access. See the FAQ for more information and a possible workaround.
  • Python 2, version 2.4 or later. See http://www.python.org/. (cvs2git does not work with Python 3.x.)
  • If you use the --use-rcs option, then RCS's `co' program is required. The RCS home page is http://www.cs.purdue.edu/homes/trinkle/RCS/. See the --use-rcs flag for more details.
  • If you use the --use-cvs option, then the `cvs' command is required. The CVS home page is http://ccvs.cvshome.org/. See the --use-cvs flag for more details.
  • Git version or later (earlier versions have a bug in "git fast-import" that prevent them from loading the files generated by cvs2git).

Development status

Most of the work of converting a repository from CVS to a more modern version control system is inferring the most likely history given the incomplete information that CVS records. cvs2svn has a long history of making sense of even the most convoluted CVS repositories, and cvs2git uses this same machinery. Therefore, cvs2git inherits the robustness and many of the features of cvs2svn. cvs2svn can convert just about every CVS repository we have ever seen, and includes a plethora of options for customizing your conversion.

The output of cvs2git is one or more dump files that can be imported into git using the excellent git fast-import tool.

Although cvs2git is considerably newer than cvs2svn, and much less well tested, it is believed that cvs2git can be used for production conversions. If you use cvs2git, please let us know how it worked for you!

cvs2git limitations

cvs2git still has many limitations compared to cvs2svn. Help would be much appreciated! Some of these missing features would be pretty easy to program, and I'd be happy to help you get started.

  • The cvs2git documentation is still not as complete as that for cvs2svn. See below for more references.
  • Differences between CVS and git branch/tag models: CVS allows a branch or tag to be created from arbitrary combinations of source revisions from multiple source branches. It even allows file revisions that were never contemporaneous to be added to a single branch/tag. Git, on the other hand, only allows the full source tree, as it existed at some instant in the history, to be branched or tagged as a unit. Moreover, the ancestry of a git revision makes implications about the contents of that revision. This difference means that it is fundamentally impossible to represent an arbitrary CVS history in a git repository 100% faithfully. cvs2git uses the following workarounds:
    • cvs2git tries to create a branch from a single source, but if it can't figure out how to, it creates the branch using a "merge" from multiple source branches. In pathological situations, the number of merge sources for a branch can be arbitrarily large. The resulting history implies that whenever any file was added to a branch, the entire source branch was merged into the destination branch, which is clearly incorrect. (The alternative, to omit the merge, would discard the information that some content was moved from one branch to the other.)
    • If cvs2git cannot determine that a CVS tag can be created from a single revision, then it creates a tag fixup branch named TAG.FIXUP, then tags this branch. (This is a necessary workaround for the fact that git only allows existing revisions to be tagged.) The TAG.FIXUP branch is created as a merge between all of the branches that contain file revisions included in the tag, which involves the same tradeoff described above for branches. The TAG.FIXUP branch is cleared at the end of the conversion, but (due to a technical limitation of the git fast-import file format) not deleted. There are some situations when a tag could be created from a single revision, but cvs2git does not realize it and creates a superfluous tag fixup branch. It is possible to delete superfluous tag fixup branches after the conversion by running the contrib/git-move-refs.py script within the resulting git repository.
  • There are no checks that CVS branch and tag names are legal git names. There are probably other git constraints that should also be checked.
  • The data that should be fed to git fast-import are written to two files, which have to be loaded into git fast-import manually. These files might grow to very large size. It would be nice to add an option to invoke git fast-import automatically and pipe the output directly into git fast-import; this should also speed up the conversion.
  • Only single projects can be converted at a time. Given the way git is typically used, this is probably what you want anyway.
  • The cvs2svn test suite does not include meaningful tests of git output.
  • cvs2git makes no attempt to convert .cvsignore files into .gitignore files.
  • cvs2git, like cvs2svn, does not support incremental conversion (i.e., tracking a live CVS repository). However, at least one person has documented a possible workaround.


There is some documentation specific to cvs2git, and much of the cvs2svn documentation also applies fairly straightforwardly to cvs2git. See the following sources:

  • This document.
  • The output of cvs2git --help.
  • The cvs2git man page. If the man page is not installed on your Unix-like system, you can view it by typing a command like cvs2git --man | groff -man -Tascii | less.
  • The cvs2svn documentation and the cvs2svn FAQ, which contain much general discussion and describe many features that can also be used for cvs2git.
  • cvs2git-example.options in the cvs2svn source tree, which is an example of an options file that can be used to configure a cvs2git conversion. The file is extensively documented.
  • The cvs2svn mailing lists, IRC channel, etc., as described in the cvs2svn FAQ.


This section outlines the steps needed to convert a CVS repository to git using cvs2git.

  1. Be sure that you have the requirements, including either RCS or CVS (used to read revision contents from the CVS repository).
  2. Obtain a copy of cvs2svn/cvs2git version 2.1 or newer. It is recommended that you use the most recent version available, or even the development version.
    • To install cvs2svn from a tarball, simply unpack the tarball into a directory on your conversion computer; cvs2git can be run directly from this directory.
    • To check out the current trunk version of cvs2svn, make sure that you have Subversion installed and then run:

      svn co --username=guest --password="" http://cvs2svn.tigris.org/svn/cvs2svn/trunk cvs2svn-trunk
      cd cvs2svn-trunk
      make man # If you want to create manpages for the main programs
      make check # ...optional

      Please note that the test suite includes tests that are marked "XFAIL" (expected failure); these are known and are not considered serious problems.

  3. Configure cvs2git and run the conversion. This can be done via command-line options or via an options file:
    • The command-line options for running cvs2git are documented in the cvs2git man page and in the output of cvs2git --help. For example:

      cvs2git \
          --blobfile=cvs2git-tmp/git-blob.dat \
          --dumpfile=cvs2git-tmp/git-dump.dat \
          --username=cvs2git \
    • The more flexible options-file method requires you to create an options file, then start cvs2git with

      cvs2git --options=OPTIONS-FILE

      Use cvs2git-example.options in the cvs2svn source tree as your starting point; the file contains lots of documentation.

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

  4. Initialize a git repository:

    git init --bare /path/to/myproject.git
    cd /path/to/myproject.git
  5. Load the dump files into the new git repository using git fast-import:

    git fast-import --export-marks=../cvs2git-tmp/git-marks.dat <../cvs2git-tmp/git-blob.dat
    git fast-import --import-marks=../cvs2git-tmp/git-marks.dat <../cvs2git-tmp/git-dump.dat

    On Linux/Unix this can be shortened to:

    cat ../cvs2git-tmp/git-blob.dat ../cvs2git-tmp/git-dump.dat | git fast-import
  6. Delete the TAG.FIXUP branch:

    git branch -D TAG.FIXUP
  7. (Optional) View the results of the conversion, for example:

    gitk --all
  8. (Recommended) To get rid of unnecessary tag fixup branches, run the contrib/git-move-refs.py script from within the git repository.
  9. (Recommended) Re-compact the repository and discard any garbage:

    git gc --prune=now
  10. The result of the above procedure is a bare git repository (one that does not have a checked-out version of the source tree). This is the type of repository that you would put on your server. To work on your project, make a non-bare clone (one that includes a checked-out source tree):

    cd $HOME
    git clone /path/to/myproject.git
    cd myproject

    Now you are ready to start editing files and committing to git!

Converting to a non-bare repository

If you want to convert into a non-bare git repository (one that includes a working tree), then you need to make two changes to the above procedure:

  • Omit the --bare option in step 4; i.e., type

    git init /path/to/myproject.git
    cd /path/to/myproject.git
  • When the conversion is done, instead of cloning as described in step 10, you need to explicitly check out the "master" version of the files into your working tree:

    git checkout master

Feedback would be much appreciated, including reports of success using cvs2git. Please send comments, bug reports, and patches to the cvs2svn mailing lists.