Chapter 12

Why Branching Is Great

Wouldn't it be great if your code could exist in a parallel universe, where you could make changes to it in one version without impacting another version? Well, with branching, you can.

SVN, Git, and Mercurial all have ways you can branch your code. In this chapter I'll show you what a branch is, when you can use branches, and how to create them in SVN, Git, and Mercurial. I'll finish the chapter by stepping through a worked example of creating a branch, committing code to it, then merging it back into the main line of development.

What is a branch?

In a version control system a branch is code that diverges ...

Get Foundation Version Control for Web Developers now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.