29

We developed a product (prototype) P_OLD in language X and we are now rewriting it from scratch as P_NEW in language Y.

Since P_NEW and P_OLD are the same product:

Should P_NEW just be a brach of P_OLD old or should it be its own repository?

What is the usual way to handle such big changes form a version control perspective?

46

You almost certainly want a new repository.

The purpose of the repository is:

  • to track history and changes so you can compare them easily
  • to manage branches and merges rather than just emailing patch files around and applying them to working directories manually

If you're totally rewriting a project from scratch then there is no point putting the rewrite in the same repository. You won't be able to apply patches written in the old language to your rewrite. Switching repos won't make the history in the old repo go away, andif you switch you won't have any weird interim stages where you have two languages kicking round in your repo.

The only reason I would even consider keeping the repository when changing languages would be if a) the languages are so similar that code can often be copy-pasted from one to the other without making any changes, or b) you have a project in which the majority of the functional content in version control is something like templates in a templating language you're retaining, and the language of the core which you're changing be translated line-for line into another language (and even then only if you know you're going to need to keep iterating the templates during the migration).

  • 2
    Depending on the length of the transition, it's useful to have the previous alive and readily accessible for comparisons. You might even be introducing test cases in the old system to help you validate that results match in the new system. – Eric Jul 15 '15 at 2:40
16

I always put rewrites in new repositories myself. That way the builds, tests, and deployments can all be done independently.

When you're rewriting a project in another language there's often very little similarity in any of those tasks like building, running tests, and deploying. You'll save yourself pain if you just isolate them in their own repository. Then you'll only need to worry about the pain of how you're going to manage the user and data transition from the old system to the new; that's always a fun thing. :)

5

If your systems are sufficiently modular and link compatible, you would benefit from a single repository and build. For example, if C system is being rewritten in C++, the C++ code could call existing functionality and incrementally replace it.

However, even in this case some might argue for starting a new repo in which relevant old code is pulled in as required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.