I need to know if there is a way to migrate my code from CVS source control to Git?
If yes, what about my history of commits?
Git offers much more tools than CVS. One of more important is "git bisect" that can be used to find a commit (revision) that introduced a bug; if your commits are small and self-contained it should be fairly easy then to discover where the bug is.
The main difference is that (as it was already said in other responses) CVS is (old) centralized version control system, while Git is distributed. But even if you use version control for single developer, on single machine (single account), there are a few differences between Git and CVS: Setting up repository.
Here is the process I used to migrate a SourceForge CVS repo to Git using cvs2git (latest stable release is here, but IIRC I used the github dev version), which works on both Windows and Linux without any compilation required since it's just Python.
Also, you don't need to own the repo with this method, you can for example migrate SourceForge projects that you don't own (you just need the right to checkout, so this works on any public repo).
How to import from sourceforge CVS to git.
First, you need to download/checkout the cvs repo with the whole history (not just checkout the HEAD/Trunk):
rsync -av rsync://PROJECT.cvs.sourceforge.net/cvsroot/PROJECT/\* cvs
then use cvs2git (python script, works on all platforms, no compilation needed):
python cvs2git --blobfile="blob.dat" --dumpfile="dump.dat" --username="username_to_access_repo" --options=cvs2git.options --fallback-encoding utf-8 cvs
this should have generated two files
blob
anddump
containing your whole cvs history. You can open them in a text editor to check that the content seems correct.
then initialize your git repo inside another folder:
mkdir gitexport/ cd gitexport git init
then load up the exported cvs history onto git:
cat ../{blob,dump}.dat | git fast-import
and then place the git commit cursor at the end of history:
git reset --hard
finally and optionally, you can push to your remote git repository:
git push -u origin master
of course you need before to
git remote add origin https://your_repo_url
Note: cvs2git.options
is a JSON formatted configuration file for cvs2git
where you can specify transforms for various things like author names (so that their nicknames will be automagically transformed to their full name after import). See the documentation here or the included example options file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With