cvsimport Git Command Guide
The git cvsimport command imports a CVS repository into Git, creating a Git repository with history that mirrors the CVS repository. It’s designed for migrating projects from CVS to Git.
git cvsimport Syntax:
Section titled “git cvsimport Syntax:”git cvsimport [<options>] <CVS_module>Options:
Section titled “Options:”| Option | Description |
|---|---|
| -v, —verbose | Verbose output |
| -d | Specify CVSROOT |
| -C | Create/import into existing Git repository |
| -r | Name for tracked remote |
| -o | Branch name for the Git branch (default: origin) |
| -i | Do not perform a checkout after importing |
| -k | Kill keywords when importing |
| -b | Specify branch to import (default: current CVS branch) |
| -m | Attempt to detect merges |
| -M | Use manual mapping |
| -S | Skip paths matching regex |
| -a | Import all commits, including empty ones |
| -p | Pass additional options to cvsps |
| -z | Set changeset fuzzy-ness (seconds, default 300) |
| -s | Substitute characters in branch names |
| -u | Convert underscores in branch names to dots |
| -L | Limit number of commits imported |
| —no-minimize-url | Don’t attempt to shorten URLs |
| —help | Display help |
Parameters:
Section titled “Parameters:”| Parameter | Description |
|---|---|
| <CVS_module> | CVS module to import |
git cvsimport Command Samples:
Section titled “git cvsimport Command Samples:”Import CVS module to Git
Section titled “Import CVS module to Git”git cvsimport -d :pserver:user@cvs.example.com:/cvs mymoduleImports the ‘mymodule’ from CVS to current directory as Git repository.
Import with custom Git directory
Section titled “Import with custom Git directory”git cvsimport -C ../git-repo -d $CVSROOT mymoduleImports into existing Git repository with custom directory.
Import specific branch
Section titled “Import specific branch”git cvsimport -b main-branch -v mymoduleImports only the ‘main-branch’ CVS branch with verbose output.
Skip certain paths
Section titled “Skip certain paths”git cvsimport -S "^doc/" mymoduleImports all paths except those starting with ‘doc/’.
Limit number of commits
Section titled “Limit number of commits”git cvsimport -L 100 mymoduleImports only the first 100 commits.
Import without checkout
Section titled “Import without checkout”git cvsimport -i mymoduleImports commits but doesn’t perform a checkout after import.
Use custom remote name
Section titled “Use custom remote name”git cvsimport -r upstream mymoduleSets remote name to ‘upstream’ instead of default ‘origin’.
How do I import a CVS repository into Git?
Section titled “How do I import a CVS repository into Git?”To import a CVS repository into Git, use:
git cvsimport -d <CVSROOT> <CVS_module>How can I import into an existing Git repository?
Section titled “How can I import into an existing Git repository?”To import into an existing Git repository, run:
git cvsimport -C <directory> -d <CVSROOT> <CVS_module>How do I import only a specific branch?
Section titled “How do I import only a specific branch?”To import only a specific branch, execute:
git cvsimport -b <branch-name> <CVS_module>How can I skip certain paths during import?
Section titled “How can I skip certain paths during import?”To skip certain paths during import, use:
git cvsimport -S <regex> <CVS_module>How do I limit the number of commits imported?
Section titled “How do I limit the number of commits imported?”To limit the number of commits imported, run:
git cvsimport -L <number> <CVS_module>Applications of the git cvsimport command
Section titled “Applications of the git cvsimport command”- Migrating legacy projects from CVS to Git
- Converting CVS repositories for modern development workflows
- Importing historical codebases into Git ecosystems
- Supporting migration strategies in enterprise environments
- Creating Git mirrors of existing CVS repositories
- Enabling modern CI/CD pipelines on CVS-based projects