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

前端 未结 2 1851
遥遥无期
遥遥无期 2020-12-16 02:10

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

相关标签:
2条回答
  • 2020-12-16 02:47

    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.

    0 讨论(0)
  • 2020-12-16 03:09

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

    0 讨论(0)
提交回复
热议问题