- cvs -d cvs-myproj@cvs.foo.com:/cvs co projectwd
- mv projectwd myproj && cd myproj
- git-cvsimport -v -C ../git-myproj -a
- cd ../git-myproj && git status
For some reason, when I've done this, I ended up with all my files marked as deleted in my working copy... If you have the same problem, a simple git reset --hard will undo the deletion.
Now do some work, and commit in your git repo.
It is now time to export these commits in the CVS repo. You can review your commits with git log origin..master (This assumes that you worked in the master branch which is the case by default. The origin branch was created by cvsimport and should not be modified unless when you actually sync it with the CVS repo). Now go back to your CVS working copy:
- cd ../myproj
- cvs up -d
- for i in `GIT_DIR=../git-piscine-j01/.git git-cherry origin work | sed -n 's/^+ //p'`; do echo Exporting $i; GIT_DIR=../git-piscine-j01/.git git-cvsexportcommit -c -p -v $i || break; done
- cvs diff -u
- git-cvsimport -v -C ../git-myproj -a
- cd ../git-myproj
- git checkout origin
- git merge master
- git checkout master
At first I did not expect to have to do steps 7 and 8 but since the sha1 sums generated by the cvsimport for the commits exported by cvsexportcommit are different, these are required so that branches stay in sync. This extra merge step should however not be of a problem since it should be a simple "fast forward" merge. The only minor inconvenience is that commits made in git, exported to CVS and imported back to git will appear twice with different sha1 IDs.
This should be enough to work with git instead of CVS.