I have a Mandelbrot Set explorer project that I have hosted on GitHub. I used it to learn how to generate the Mandelbrot set, and to get more experience with using the Java ExecutorService. It works great, but I've just been tacking on new pieces as I go along, and it's becoming a mess. It's already broken twice after I made small changes to a small part of the code.I decided that a complete rewrite is necessary, but obviously I want to keep the old messy, but working code. I've thought of 2 basic ways of going about this:Start an entirely new project. I'd like to avoid doing this as the goal of the code is the same, and really, the end results should be the same. They're conceptually the same project.Branch the old code off into a messy-working branch, start a new branch for the new attempt, then rebase into the new code.I imagine the branching idea would work, but I don't have a ton of experience with Git.Are there any pitfalls to creating a new branch of code that shares very little (if anything) with other branches? If this isn't a good idea, is there a better way of going about it?
Safe way of starting a project from scratch while keeping old, working code
version control;git
If you are starting from scratch, it makes sense to start a new project. I'd like to avoid doing this as the goal of the code is the same, and really, the end results should be the same : Version control tools are not about the output of a program, but about the code. For example many Linux tools mimic exactly the behavior of closed-source Unix tools, and they don't share code.In the other hand, version control systems and appropriate unit tests help you refactor the old, messy code into a new, clean code. Writing tests (which the old, messy code pass) and making sure that the refactored code passes them too, is like a safety net. If you decide to make this, then branching is a good option. The fact that the old code works great, makes tests written for it, a very good tool for validating the new, cleaner version.