I like to reuse some code of a GIT maintained project for another project. The working code is a good kickstart to the new project, despite most of it would come obsolete for the new needs. So the question is what would be the best practice for handling that?
I could
-
Make a new repository for the new thing and cherry pick the files from the old project. After stripping the code to match the needed basic funcitonality of the new project do the first commit to keep it’s history clean from useless things. Maybe it takes some time to conform this goal. Also, there is no way to merge enhancements done in the old project.
-
Branch the old code and adapt it to it’s new job step by step. That means the two projects will stay entangled inside one repository, that has one name, one README on GitHub etc.
-
Create the new project, beginning with a minimal main part, and another library project, serving as a common collection for both the old and the new project. However, with HTML and JS development, that makes many headaches as importing is complex in JS, impossible in HTML, there is the need to pull two repo’s to get each of the project running etc.
What would you do? Are there any GIT tricks that would support me?
Perhaps this is less of a version control problem and more of a refactoring one. It sounds like there may be enough shared code to pull out common functionality to its own project, which you could reference (by
git-subtreeorgit-submodule) in the others. This way, if you do make fixes/improvements to the shared code, all your projects could benefit.