1

I have a working web app that I version control using Git - call this v1.0. I learnt a lot during that development including some of the mistakes I made. I now want to re-write parts of the code to follow best (better?!) practices and allow better maintainability. Should I create a new repo or should I clone? (I am using BitBucket).

My intention is to keep the original v1.0 (for now) as the working/'production' version whilst I work on the re-write. What is the best practise to handle this scenario?

SimpleOne
  • 199
  • 1
  • 7

2 Answers2

6

I suppose the answer to your question entirely depends on whether or not you consider the product to be a new one or not. If you consider it to be a new product, you should most certainly clone your repository to start with. Though, I assume if you're rewriting only parts of your program, it is the same product, and therefore you should probably simply create a branch of the original project and work on that.

Once you think you've achieved something which can fully replace the functionality of the old product and you've tested it thoroughly, you can completely replace the contents of the main branch with your development branch.

Neil
  • 22,848
1

Assuming you use a languanguage language that supports interfaces and dependencyinjection

I would use the same repository and would refactor the old existing code into services with interfaces before the rewrite and then re-implement the services in the rewrite by and by.

benefits

  • both old and new can co-exist in the same repro-branch
  • decide through config if you want to use the old or the new implementation.
  • iterative reimlementation where parts of the old system are reimplemented by and by. The alternative would be a big-bang-replacement of all of the old system with the new one which (from my experience) causes much more problems than a gracefull migration.
k3b
  • 7,621