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 co
I usually prefer to keep versions of the same project in the same repository.
For instance, I have a project I created in classic ASP several years ago under SVN, then I migrated the project to PHP + Git and finally to Ruby + Git. Actually, the 3 versions were a complete rewrite because I changed the technology behing the code, but everything is on the same repository.
I can even decide to checkout a very old version, if I need to.
Using separate repository has the advantage to reduce repository size, but Git has a very efficient compression algorithm (compared for instance with SVN) and I saw 800Mb SVN repositories compressed in less than 100Mb in Git.
Honestly, I believe it's a matter of taste.
Using separate repositories reduce repository size.
Using the same repository has the advantage of keeping the entire history of the project in the same place. You can even tag versions to easily swtich between them. Last but not least, if you reuse assets between versions, Git is able to optimize them and store them just once.
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")