hgbook
changeset 202:6f167e644762
Start writing about named branches.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Fri Apr 20 14:02:10 2007 -0700 (2007-04-20) |
parents | 80fc720338a5 |
children | d7615e15510f |
files | en/Makefile en/branch.tex en/examples/branch-named |
line diff
1.1 --- a/en/Makefile Wed Apr 18 15:48:00 2007 -0700 1.2 +++ b/en/Makefile Fri Apr 20 14:02:10 2007 -0700 1.3 @@ -56,6 +56,7 @@ 1.4 backout \ 1.5 bisect \ 1.6 branching \ 1.7 + branch-named \ 1.8 branch-repo \ 1.9 cmdref \ 1.10 daily.copy \
2.1 --- a/en/branch.tex Wed Apr 18 15:48:00 2007 -0700 2.2 +++ b/en/branch.tex Fri Apr 20 14:02:10 2007 -0700 2.3 @@ -224,6 +224,41 @@ 2.4 to the main branch. 2.5 \interaction{branch-repo.merge} 2.6 2.7 +\section{Naming branches within one repository} 2.8 + 2.9 +In most instances, isolating branches in repositories is the right 2.10 +approach. Its simplicity makes it easy to understand; and so it's 2.11 +hard to make mistakes. There's a one-to-one relationship between 2.12 +branches you're working in and directories on your system. This lets 2.13 +you use normal (non-Mercurial-aware) tools to work on files within a 2.14 +branch/repository. 2.15 + 2.16 +If you're more in the ``power user'' category (\emph{and} your 2.17 +collaborators are too), there is an alternative way of handling 2.18 +branches that you can consider. I've already mentioned the 2.19 +human-level distinction between ``small picture'' and ``big picture'' 2.20 +branches. While Mercurial works with multiple ``small picture'' 2.21 +branches in a repository all the time (for example after you pull 2.22 +changes in, but before you merge them), it can \emph{also} work with 2.23 +multiple ``big picture'' branches. 2.24 + 2.25 +The key to working this way is that Mercurial lets you assign a 2.26 +persistent \emph{name} to a branch. There always exists a branch 2.27 +named \texttt{default}. Even before you start naming branches 2.28 +yourself, you can find traces of the \texttt{default} branch if you 2.29 +look for them. 2.30 + 2.31 +As an example, when you run the \hgcmd{commit} command, and it pops up 2.32 +your editor so that you can enter a commit message, look for a line 2.33 +that contains the text ``\texttt{HG: branch default}'' at the bottom. 2.34 +This is telling you that your commit will occur on the branch named 2.35 +\texttt{default}. 2.36 + 2.37 +To start working with named branches, use the \hgcmd{branches} 2.38 +command. This command lists the named branches already present in 2.39 +your repository. 2.40 +\interaction{branch-named.branches} 2.41 + 2.42 %%% Local Variables: 2.43 %%% mode: latex 2.44 %%% TeX-master: "00book"
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/en/examples/branch-named Fri Apr 20 14:02:10 2007 -0700 3.3 @@ -0,0 +1,10 @@ 3.4 +#!/bin/bash 3.5 + 3.6 +hg init a 3.7 +cd a 3.8 +echo hello > myfile 3.9 +hg commit -A -m 'Initial commit' 3.10 + 3.11 +#$ name: branches 3.12 + 3.13 +hg branches