When should you branch?

后端 未结 12 1358
情深已故
情深已故 2020-11-22 04:24

When working with a SCM system, when should you branch?

12条回答
  •  无人及你
    2020-11-22 04:42

    All the 21th century SCMs are telling you:

    Branch for every task you've to work on, no matter whether this is a new feature, a bugfix, a test, whatever. This is called topic branch, and it changes the way you work with your SCM.

    You get:

    • Better isolation
    • Better traceability -> you associate tasks with branches, not individual changesets, which makes you free to commit as many times as you want and doesn't impose a limit like "one checkin per task".
    • Tasks are independent (normally starting from a stable baseline, so you only focus on your code, not on fixing bugs from your folks), and you can choose whether you want to integrate them at some point or later, but they're always under version control
    • You can review code easily (from the version control, not pre-commit bullshit) before hitting the main line

    Tools that can do it:

    • Git
    • Mercurial
    • Plastic SCM

    Tools that CAN'T do it:

    • SVN
    • CVS
    • VSS
    • TFS
    • Perforce

提交回复
热议问题