Is there a migration tool from CVS to Git?

前端 未结 12 1889
栀梦
栀梦 2020-11-27 13:34

I intend to switch over from CVS to Git. In the case of SVN, there seems to be cvs2svn. Is there a similar tool to easily migrate from CVS to Git?

12条回答
  •  心在旅途
    2020-11-27 13:39

    cvs2git

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

    Prerequisites

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

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

    1. checkout modulename

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

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

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

      # edit this
      run_options.set_project(  r'modulename',
      
      # and this
      author_transforms={
          'jrandom' : ('J. Random', 'jrandom@example.com'),
          'mhagger' : 'Michael Haggerty ',
      
    5. run cvs2git to create git temp files

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

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

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

      git reset --hard
      

提交回复
热议问题