ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial
Web Hosting by 1&1

32.1.8 Multiple Branches of a File

One use of version control is to maintain multiple “current” revisions of a file. For example, you might have different revisions of a program in which you are gradually adding various unfinished new features. Each such independent line of development is called a branch. VC allows you to create branches, switch between different branches, and merge changes from one branch to another. Please note, however, that branches are not supported for SCCS.

A file's main line of development is usually called the trunk. You can create multiple branches from the trunk. How the difference between trunk and branch is made visible is dependent on whether the VCS uses dot-pair or monotonic version IDs.

In VCSes with dot-pair revision IDs, the revisions on the trunk are normally IDed 1.1, 1.2, 1.3, etc. At any such revision, you can start an independent branch. A branch starting at revision 1.2 would have revision ID 1.2.1.1, and consecutive revisions on this branch would have IDs 1.2.1.2, 1.2.1.3, 1.2.1.4, and so on. If there is a second branch also starting at revision 1.2, it would consist of revisions 1.2.2.1, 1.2.2.2, 1.2.2.3, etc.

In VCSes with monotonic revision IDs, trunk revisions are IDed as 1, 2, 3, etc. A branch from (say) revision 2 might start with 2.1 and continue through 2.2, 2.3, etc. But naming conventions for branches and subbranches vary widely on these systems, and some (like Mercurial) never depart from the monotonic integer sequence at all. Consult the documentation of the VCS you are using.

If you omit the final component of a dot-pair revision ID, that is called a branch ID. It refers to the highest existing revision on that branch—the head revision of that branch. The branches in the dot-pair example above have branch IDs 1.2.1 and 1.2.2.

blog comments powered by Disqus