// Converting from CVS to GIT
This post is a short description how to convert a CVS repository into GIT. I used the tool cvs2svn from Tigris.org for this task. As an example I will use the project jake2.
0. Install cvs2svn and cvs
('cvs2svn' not only does cvs2svn conversion it also contains the shell commands cvs2git and cvs2bzr)
sudo apt-get install cvs
sudo apt-get install cvs2svn
1. Download the CVS repository
This is mandatory. In contrary to SVN you can't just read out the complete versioning history just by using the CVS protocol. To convert from CVS you will need direct file access to the repository.Sourceforge for example supports repository synchronization via rsync to allow backups. Thats what I used to get a copy of the jake2 repository.
rsync -av rsync://jake2.cvs.sourceforge.net/cvsroot/jake2/* .
2. Convert into GIT fast-import format
Take a look at /usr/share/doc/cvs2svn/examples/cvs2git-example.options.gz and extract the example configuration file. The file is very good documented so I won't repeat things here. But the most important step is to provide an author mapping from cvs to git authors (search for 'author_transforms').
cvs2git --options=cvs2git.options
This will produce a dump and blob file for step 3.
3. Create GIT repository and import CVS history
mkdir gitrepo
cd gitrepo
git init
cat ../repo-tmp/git-blob.dat ../repo-tmp/git-dump.dat | git fast-import
4. Manual cleanup
cvs2git will do its best to convert tags and branches into git tags and branches and usually add an artificial commit do document that. Now you will probably want to take a look at the repository with a history browser like gitk or giggle... and clean it up a bit. E.g remove branches which could be tags etc. If this is to much work you might consider to tweak the configuration of step 2 and convert again with different strategies.- - - -
btw you can find the jake2 git repo here.
You forgot
git reset --hard
As the last step. See also:
http://blog.gorwits.me.uk/2011/06/22/migrate-sourceforge-cvs-repository-to-git/
Posted by Ricardo Fabbri on August 09, 2011 at 05:20 AM CEST #