GNU Emacs Manual - Creating Branches

Go to the first, previous, next, last section, table of contents.

#### Creating New Branches

To create a new branch from a head version (one that is the latest in the branch that contains it), first select that version if necessary, lock it with `C-x C-q`, and make whatever changes you want. Then, when you check in the changes, use `C-u C-x C-q`. This lets you specify the version number for the new version. You should specify a suitable branch number for a branch starting at the current version. For example, if the current version is 2.5, the branch number should be 2.5.1, 2.5.2, and so on, depending on the number of existing branches at that point.

To create a new branch at an older version (one that is no longer the head of a branch), first select that version (see section Switching between Branches), then lock it with `C-x C-q`. You'll be asked to confirm, when you lock the old version, that you really mean to create a new branch--if you say no, you'll be offered a chance to lock the latest version instead.

Then make your changes and type `C-x C-q` again to check in a new version. This automatically creates a new branch starting from the selected version. You need not specially request a new branch, because that's the only way to add a new version at a point that is not the head of a branch.

After the branch is created, you "stay" on it. That means that subsequent check-ins create new versions on that branch. To leave the branch, you must explicitly select a different version with `C-u C-x C-q`. To transfer changes from one branch to another, use the merge command, described in the next section.

Go to the first, previous, next, last section, table of contents.