CVS and RCS to Git: version control and migration today
CVS and RCS still run on a few old servers, but new work belongs in Git. If you know CVS, you already know most of the ideas: check out, commit, diff, tag. This page maps the old commands to Git, then shows how to move a CVS, RCS or Subversion history into Git without losing it.
The classic CVS-RCS HOWTO has been withdrawn from tldp.org for review. As of November 2026, Git 2.56 is the current release (Debian 13 ships 2.47). Everything below works with any Git from the last few years.
What changes when you move to Git
- Every clone is a full repository. You can commit, branch and read history offline. Sharing happens when you push to, or pull from, another repository.
- Commits cover the whole tree. In CVS each file had its own revision number (1.17, 1.4.2.3). In Git one commit records a change to many files at once and gets one ID, such as
3f9a1c2. - Branches are cheap. Creating, merging and deleting them takes a second, so you use one per feature or fix.
- No file locking. RCS made you lock a file with
co -lbefore editing. Git lets everyone edit, then merges, and asks you to resolve real conflicts. - Tags are snapshots of a commit. CVS tags could label any mix of file revisions. A Git tag always points to one complete tree.
The commands side by side
| Task | CVS / RCS | Git |
|---|---|---|
| Get a working copy | cvs checkout proj | git clone URL |
| Bring in others' changes | cvs update -d | git pull |
| Add a file | cvs add file | git add file |
| Remove a file | cvs remove file | git rm file |
| Rename a file | (remove + add, history lost) | git mv old new |
| Show changes | cvs diff -u / rcsdiff | git diff |
| Commit | cvs commit / ci -u | git commit -a, then git push |
| History | cvs log / rlog | git log |
| Who changed each line | cvs annotate | git blame file |
| Status | cvs -n update | git status |
| Tag a release | cvs tag REL_1_4 | git tag -a v1.4.0, then git push origin v1.4.0 |
| Make a branch | cvs tag -b | git switch -c name |
| Undo local edits | rm file; cvs update file | git restore file |
A first Git session
Install Git (sudo apt install git on Debian and Ubuntu, sudo dnf install git on Fedora and RHEL, sudo pacman -S git on Arch). Tell Git who you are, once per user:
git config --global user.name "Ada Lovelace"
git config --global user.email "ada@example.org"
git config --global init.defaultBranch main
Put an existing directory under version control, then work on a branch:
cd ~/src/report-tool
git init
git add .
git commit -m "Import report-tool"
git switch -c fix-dates # new branch, and switch to it
$EDITOR report.c
git diff # review
git commit -am "Parse ISO dates"
git switch main
git merge fix-dates
git log --oneline --graph
Add a .gitignore file listing build output (*.o, build/) the same way you used .cvsignore.
What about $Id$ and $Log$?
Git does not expand RCS keywords by default. If you need $Id$, set the ident attribute in .gitattributes (for example *.c ident). Git then replaces $Id$ with the file's blob ID on checkout. That is a content hash, not a revision number. There is no $Log$, $Revision$ or $Author$. Most projects simply delete these lines after migrating, because git log and git blame give the same information.
Convert a CVS repository
All CVS converters read the repository's ,v files directly. A working checkout is not enough. If the server is remote, copy the whole repository first, for example with rsync -a cvs.example.org:/var/cvs/ ./cvsroot/. Freeze the CVS server before the final run, because these tools do not follow a live repository.
Option 1: cvs-fast-export (packaged)
cvs-fast-export is packaged in Debian 13 and Ubuntu (sudo apt install cvs-fast-export). It also reads plain RCS collections, so it covers both cases. It writes a Git fast-import stream:
cd cvsroot/myproject
find . | cvs-fast-export -A ~/authors.map > ~/myproject.fi
cd ~
git init myproject
cd myproject
git fast-import < ~/myproject.fi
git branch -a # see which branches were created
git switch master # or whichever branch holds the trunk
The author map turns CVS user names into real identities, one per line: ferd = Ferd J. Foonly <foonly@example.org>. You can also add an optional time zone after the address (America/Chicago). Non-ASCII user IDs are not supported.
Option 2: cvs2git
cvs2git, part of cvs2svn, is very good at making sense of tangled histories. However, the project says it is in maintenance mode, and it needs Python 2, which current distributions no longer ship. Its source tree includes a Dockerfile that builds a working environment, and its README calls that the easiest way to run it today. The conversion itself looks like this:
cvs2git --blobfile=cvs2git-tmp/git-blob.dat \
--dumpfile=cvs2git-tmp/git-dump.dat \
--username=cvs2git /path/to/cvsroot/myproject
git init --bare myproject.git
cd myproject.git
cat ../cvs2git-tmp/git-blob.dat ../cvs2git-tmp/git-dump.dat | git fast-import
git branch -D TAG.FIXUP
git gc --prune=now
The result is a bare repository, ready for a server. Clone it to work on it.
Why not git cvsimport?
Git still includes git cvsimport, but its own manual warns against it. It needs the deprecated cvsps version 2, and it can import history incorrectly. Its known problems include misordered commits, empty branches dropped, and multiple tags on one revision not imported. For a one-time conversion, the manual itself points to cvs2git or cvs-fast-export.
Convert a Subversion repository
git svn (package git-svn on Debian and Ubuntu) can clone a Subversion repository with full history. First list every Subversion committer in an authors file. git svn stops if it finds a name that is not in the file:
# authors.txt
jsmith = Jane Smith <jane@example.org>
build = Build Robot <>
git svn clone https://svn.example.org/repos/proj --stdlayout \
--prefix=svn/ --authors-file=authors.txt proj
cd proj
git svn create-ignore # turn svn:ignore into staged .gitignore files
git commit -m "Convert svn:ignore to .gitignore"
--stdlayout means the usual trunk, branches and tags directories. Subversion tags are copies that can be changed later, so git svn imports them as branches named svn/tags/…. After the final sync, turn each one into a real tag with git tag, then delete the branch. For large or messy histories, look at reposurgeon (also packaged in Debian 13). It is built to clean up conversions.
Check the conversion
- Run
git fsckin the new repository. - Check out the old trunk head and the new main branch side by side, then compare them with
diff -r. The only differences should come from keyword expansion and ignore files. - Check a few old tags the same way, especially the last two releases.
- Look at
git log --graph --allfor odd merges or branches namedTAG.FIXUP. - Make the old repository read-only, and keep a tarball of it.
Where to host it
The simplest server is a bare repository reached over SSH, with no extra software:
ssh git.example.org 'git init --bare /srv/git/myproject.git'
git remote add origin git.example.org:/srv/git/myproject.git
git push -u origin main
git push origin --tags
For a web interface, issues and code review, you can self-host Forgejo, Gitea or GitLab. Or you can use a hosted service such as Codeberg, GitLab.com or GitHub. Because every clone is complete, moving between hosts later is just another push.
Mistakes to avoid
- Converting from a checkout: converters need the
,vfiles from the repository itself. - Forgetting the authors map: without it, history shows bare login names. Fixing that afterwards means rewriting every commit ID.
- Committing on both systems during the switch: pick a cut-over date, freeze CVS or SVN, and do the final conversion then.
- Committing build output: add a
.gitignorebefore your firstgit add ..
Next: tag, sign and ship releases, or use Git from your editor with Emacs.
Sources
- Git home page (current release), git-scm.com
- git-switch, git-tag, git-push and gitattributes (ident), git-scm.com
- git-cvsimport (warnings and issues), git-scm.com
- git-svn documentation, git-scm.com
- cvs-fast-export(1), Debian
- cvs2svn / cvs2git repository and README (maintenance mode, Dockerfile)
- cvs2git documentation (cvs2git.html in the cvs2svn repository)
- cvs-fast-export and git-svn packages, Ubuntu 26.04; git-svn package (Git 2.47), Debian 13