When to branch

Create a branch when two sets of files have different submission policies or need to evolve separately. For example:

  • Problem : the development group wants to submit code to the depot whenever their code changes, regardless of whether it compiles, but the release engineers don’t want code to be submitted until it’s been debugged, verified, and approved.

    Solution: create a release branch by branching the development codeline. When the development codeline is ready, it is merged into the release codeline. Patches and bug fixes are made in the release code and merged back into the development code.

  • Problem: a company is writing a driver for a new multi-platform printer. The UNIX device driver is done and they are beginning work on an OS X driver, using the UNIX code as their starting point.

    Solution: create an OS X branch from the existing UNIX code. These two codelines can evolve separately. If bugs are found in one codeline, fixes can be merged to the other.

One basic strategy is to develop code in a mainline stream and create streams for releases. Make release-specific bug fixes in the release streams and, if required, merge them back into the mainline stream.