# HG changeset patch # User Bryan O'Sullivan # Date 1177102930 25200 # Node ID 6f167e6447623aeb2641e155b4d01935e6f71190 # Parent 80fc720338a59239a5997af237ba55dbe6d76c49 Start writing about named branches. diff -r 80fc720338a5 -r 6f167e644762 en/Makefile --- a/en/Makefile Wed Apr 18 15:48:00 2007 -0700 +++ b/en/Makefile Fri Apr 20 14:02:10 2007 -0700 @@ -56,6 +56,7 @@ backout \ bisect \ branching \ + branch-named \ branch-repo \ cmdref \ daily.copy \ diff -r 80fc720338a5 -r 6f167e644762 en/branch.tex --- a/en/branch.tex Wed Apr 18 15:48:00 2007 -0700 +++ b/en/branch.tex Fri Apr 20 14:02:10 2007 -0700 @@ -224,6 +224,41 @@ to the main branch. \interaction{branch-repo.merge} +\section{Naming branches within one repository} + +In most instances, isolating branches in repositories is the right +approach. Its simplicity makes it easy to understand; and so it's +hard to make mistakes. There's a one-to-one relationship between +branches you're working in and directories on your system. This lets +you use normal (non-Mercurial-aware) tools to work on files within a +branch/repository. + +If you're more in the ``power user'' category (\emph{and} your +collaborators are too), there is an alternative way of handling +branches that you can consider. I've already mentioned the +human-level distinction between ``small picture'' and ``big picture'' +branches. While Mercurial works with multiple ``small picture'' +branches in a repository all the time (for example after you pull +changes in, but before you merge them), it can \emph{also} work with +multiple ``big picture'' branches. + +The key to working this way is that Mercurial lets you assign a +persistent \emph{name} to a branch. There always exists a branch +named \texttt{default}. Even before you start naming branches +yourself, you can find traces of the \texttt{default} branch if you +look for them. + +As an example, when you run the \hgcmd{commit} command, and it pops up +your editor so that you can enter a commit message, look for a line +that contains the text ``\texttt{HG: branch default}'' at the bottom. +This is telling you that your commit will occur on the branch named +\texttt{default}. + +To start working with named branches, use the \hgcmd{branches} +command. This command lists the named branches already present in +your repository. +\interaction{branch-named.branches} + %%% Local Variables: %%% mode: latex %%% TeX-master: "00book" diff -r 80fc720338a5 -r 6f167e644762 en/examples/branch-named --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/en/examples/branch-named Fri Apr 20 14:02:10 2007 -0700 @@ -0,0 +1,10 @@ +#!/bin/bash + +hg init a +cd a +echo hello > myfile +hg commit -A -m 'Initial commit' + +#$ name: branches + +hg branches