Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting from scratch for v2.0. Should I keep using the existing git repo or start a new one?

Tags:

git

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.

like image 215
znq Avatar asked Oct 04 '11 10:10

znq


People also ask

When should I start a new repository?

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.

Should I git initialize everytime?

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.

Should I git initialize before git clone?

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 .


1 Answers

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")

like image 89
VonC Avatar answered Sep 30 '22 14:09

VonC