Become a fan of Slashdot on Facebook


Forgot your password?
Programming Linux

Linus On Branching Practices 90

rocket22 writes "Not long ago Linus Torvalds made some comments about issues the kernel maintainers were facing while applying the 'feature branch' pattern. They are using Git (which is very strong with branching and merging) but still need to take care of the branching basics to avoid ending up with unstable branches due to unstable starting points. While most likely your team doesn't face the same issues that kernel development does, and even if you're using a different DVCS like Mercurial, it's worth taking a look at the description of the problem and the clear solution to be followed in order to avoid repeating the same mistakes. The same basics can be applied to every version control system with good merge tracking, so let's avoid religious wars and focus on the technical details."
This discussion has been archived. No new comments can be posted.

Linus On Branching Practices

Comments Filter:
  • by Anrego ( 830717 ) * on Tuesday November 30, 2010 @01:24PM (#34390716)

    Which I imagine makes sense, as the kernel is very complicated from a dev standpoint.

    For most projects I’ve been involved with, the path to success is keeping the trunk in a stable state, and using _that_ as the baseline. Dev code should never be in the trunk imo... the trunk should always be in a ready to release (or proceed to formal testing, or whatever) state. Everyone branches from the trunk.. everyone can update their branch to the latest trunk.. and everyone merges back down into the trunk when it’s good and ready.

    Resisting the temptation to make “quick fixes” in the trunk is also important. Additionally, dev platforms should be setup so the system can be run from any branch as easily as the trunk (making it a pain to test out the system from a branch is a great way to ensure unstable code ends up in your trunk).

    Obviously in the case of the kernel.. they probably have branches off branches off branches, but I think for most reasonably sized projects, that shouldn’t be necessary.

  • by Anonymous Coward on Tuesday November 30, 2010 @01:34PM (#34390876)

    Even the best merge tools can't guarantee the logic of the merged code is correct no matter how stable/good your branch point is.

  • by assemblyronin ( 1719578 ) on Tuesday November 30, 2010 @01:37PM (#34390934)

    I think you actually restated the point that Linus made in the original thread. Which was: Don't branch and start new development from an unknown state.

    For you, the stable baseline is equal to the trunk. For Linus, the stable baseline is equal the labeled release build node.

  • by Anonymous Coward on Tuesday November 30, 2010 @01:48PM (#34391110)

    You merge several branches together into a "integration" branch, then test that and merge it to the trunk if it passes.

  • by syousef ( 465911 ) on Tuesday November 30, 2010 @01:49PM (#34391128) Journal

    The whole story seems to be summed up by: "Don't just branch from some random point. Wait until your code is stable and branch from that." and "Create these stable points from which you can branch as often as is practical". I'm sorry but I've never been tempted to branch from an unstable point, and I'd be horrified if anyone on my time tried to do so.

    As for only adding features to a stable release I find that depends on the size, complexity and maturity of the project. Early on nothing is feature complete and everyone tends to work on an unstable head/trunk/master/whatever-your-scm-calls-it. Once development has settled down and there's been a release, it's much more controlled and people do tend to add their code from a stable point.

    I'm sorry I just don't see any life changing revelations here.

  • by vlm ( 69642 ) on Tuesday November 30, 2010 @01:53PM (#34391220)

    Some devs know where STABLE is located, some devs know what direction their new code is going, and a successful merge is where a dev violates the Heisenberg Uncertainty Principle and accomplish both at the same time.

  • by gstoddart ( 321705 ) on Tuesday November 30, 2010 @02:15PM (#34391620) Homepage

    Usually they grow out of this type of practice after they spend a few days untangling a mess they've created, but there are some die-hards who just hate having to deal with anybody else, and insist on doing their own thing.

    And those people get smacked on the knuckles with a ruler. If they keep failing to abide by your policies, you smack 'em on the ass with the ruler. If they keep going like that, you get rid of them.

    There are very few things more destructive to a development team than some prima donna who won't follow the rules and procedures. In the long run, if they won't play by the rules laid down, they'll do more harm than good.

    Source Code Management and "cowboys" can't really coexist if you want to be able to have maintainable software. I've seen someone who would apply changes to any old branch and more or less decree it was someone else's problem to get them onto main -- buh bye, if you're sabotaging the build process, we don't need you.

  • by Americano ( 920576 ) on Tuesday November 30, 2010 @02:29PM (#34391876)

    I agree, and if the choice were mine, there are some people I work with who would be pink-slipped immediately... but, politics at a large-ish company being what they are, it's a matter of demonstrating to managers that the actions are counter-productive and costing us time and money... then letting them draw the proper conclusions. In a well-run meritocracy, these people would be gone for violating the "No Asshole" rule.

    The problem is, some of the managers are over-promoted cowboys themselves - I've heard, no exaggeration, the following from a manager when I was arguing for locking down one of our production systems because people kept making changes live: "I know it's good policy, but as soon as policy slows down my developers, the policy goes out the window."

    The technical problems are easy. It's this political maneuvering that requires the patience of a saint.

  • by gstoddart ( 321705 ) on Tuesday November 30, 2010 @02:34PM (#34391982) Homepage

    I've heard, no exaggeration, the following from a manager when I was arguing for locking down one of our production systems because people kept making changes live: "I know it's good policy, but as soon as policy slows down my developers, the policy goes out the window."

    Run. Run fast, run far.

    If managers are going to support the notion of un-tracked changes on a production server in the name of getting things done, then eventually someone will be looking to lay blame for something that went horribly wrong.

    Failure to understand why people have change procedures for live systems is pretty significant. And, depending on your industry ... un-tracked fixes and tweaks can actually get you in legal trouble. Think Sarbanes-Oxley.

    In almost any sane shop, failure to follow the change procedures can be a grounds for immediate dismissal.

  • by Americano ( 920576 ) on Tuesday November 30, 2010 @03:20PM (#34392750)

    I'm sorry, how does "automated testing of the main line via a CI tool after the changes are committed to the main line" assure that your main line stays stable?

    "Virtually stable" is not "stable". When you work for a financial services firm whose livelihood depends on the market data and trading systems your team builds, "virtually stable" is nowhere near "stable" and doesn't even begin to approach "good enough".

  • by wrench turner ( 725017 ) on Tuesday November 30, 2010 @03:46PM (#34393226)
    It's not the CI tool that assures that mainline is stable; it's the quality of the regressions.

The moon may be smaller than Earth, but it's further away.