I have a git repo which has code for all 1.x releases. Now I'm starting to work on the 2.x "branch". Since I'm starting to code that completely from scratch again (no connection between 1.x and 2.x) I'm wondering if 2.x is actually a real branch or if I should better start a completely new repository for that.
Wondering what the advantages and disadvantages of each solution are. I could imagine that switching from a 1.x branch to a 2.x branch will take quite some time.
A new repo should only be created for a new project. For instance, if you are working on a 2 different e-commerce sites, don't put them in the same repo unless they have to work together.
git init initialises (i.e. creates) a repository. Each project should be in its own repository. If you downloaded your project using git clone then you don't need to run git init again. You should be able to copy your project to another directory without any adverse effects.
Typically, you only use git init if you already have code and you want to put it in a new Git repository. In answer to your question: if you want to clone a project, then you do not need git init .
If you decide to keep both versions in the code (which makes sense), you can create a second root branch:
git checkout --orphan branchForV2
(as detailled in "How to merge codeline with git" and in "Deploying a Re-Written Github/Heroku App")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With