How to guerilla VC with git while forced to use CVS at work?
Asked Answered
E

2

8

My place of work currently uses CVS. A git migration is planned but it might be a long time coming. In the mean time I have a one-man project, and have decided to use git for my own personal development. The branching, staged commits, rebasing etc. has been fantastic! But unfortunately at some point this project, and its history, needs to be imported into CVS, so others can check my progress.

What's the best way to...

  • import the current project (ideally as a set of separate commits/revisions) into CVS
  • allow repeatable imports of future changes into CVS
  • (bonus question - ideal but not required) merge any CVS changes by other developers back into git

Nothing is in CVS at the moment, if it matters. (And if I had my way nothing would ever be in CVS, but I'm stuck with it for now!) Thanks in advance!

Econometrics answered 5/3, 2010 at 22:20 Comment(3)
git can act as a cvs server, and I'm pretty sure it can also pull from cvs (pretty much like git-svn).Valoniah
possible duplicate of How to export revision history from mercurial or git to cvs?Anselme
Thanks, the answer there is really good. Fortunately we've moved to git now :)Econometrics
F
2

While I have no explicit CVS knowledge I would suggest the following setup.

  • Work\Project.git <-- git repo
  • Sync\Project <-- git clone of master branch in ..\Work\Project.git + CVS version control on this folder.

Than you can do all your git stuff in Project.git and when you want to import into CVS, you go to Sync\Project and do a git pull to replay the changes in your sync dir (perhaps you need to do a full dir checkout in CVS?).

For the reverse scenario, you might need to work with import branch but I think it would be possible to get the changes from your colleages in the sync folder, but do that import in a new branch, and merge that with your master branch which you pulled from your main git repository. After this merge, you could git push the changes back to your Work\Project.git.

In essence, use your sync repository just as if you're another dev. You might even let the regular repository pull from your sync (so send a pull request to yourself ;-) ) or use the git send patch mechanism to update your main git repository.

Importing the CVS change set in git, there is a git-cvsimport which should help you with that.

Flannelette answered 5/3, 2010 at 22:33 Comment(4)
This sounds good, the only thing it doesn't handle is preserving my existing revision history. git-cvsexportcommit is a bit unstable.Econometrics
hmm.. well you could generate patches from your git repo, and replay them as commits in your sync repo. With a bit of time you could even write a script for that.Flannelette
I'm experimenting, it'll involve a lot of manual work, but it's doable. Thanks for the detailed response!Econometrics
Your welcome, after some time, you'll notice a pattern and you can create some scripts to automate this process, but at least you'll be in control over the synchronization.Flannelette
I
2

git cvsimport and git cvsexportcommit can give you a workflow similar to git svn

Indoxyl answered 6/3, 2010 at 0:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.