hgbook
changeset 203:d7615e15510f
More about named branches, and early use of them.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Fri Apr 20 14:35:39 2007 -0700 (2007-04-20) |
parents | 6f167e644762 |
children | 927e74f0e838 |
files | en/branch.tex en/examples/branch-named |
line diff
1.1 --- a/en/branch.tex Fri Apr 20 14:02:10 2007 -0700 1.2 +++ b/en/branch.tex Fri Apr 20 14:35:39 2007 -0700 1.3 @@ -256,8 +256,38 @@ 1.4 1.5 To start working with named branches, use the \hgcmd{branches} 1.6 command. This command lists the named branches already present in 1.7 -your repository. 1.8 +your repository, telling you which changeset is the tip of each. 1.9 \interaction{branch-named.branches} 1.10 +Since you haven't created any named branches yet, the only one that 1.11 +exists is \texttt{default}. 1.12 + 1.13 +To find out what the ``current'' branch is, run the \hgcmd{branch} 1.14 +command, giving it no arguments. This tells you what branch the 1.15 +parent of the current changeset is on. 1.16 +\interaction{branch-named.branch} 1.17 + 1.18 +To create a new branch, run the \hgcmd{branch} command again. This 1.19 +time, give it one argument: the name of the branch you want to create. 1.20 +\interaction{branch-named.create} 1.21 + 1.22 +After you've created a branch, you might wonder what effect the 1.23 +\hgcmd{branch} command has had. What do the \hgcmd{status} and 1.24 +\hgcmd{tip} commands report? 1.25 +\interaction{branch-named.status} 1.26 +Nothing has changed in the working directory, and there's been no new 1.27 +history created. As this suggests, running the \hgcmd{branch} command 1.28 +has no permanent effect; it only tells Mercurial what branch name to 1.29 +use the \emph{next} time you commit a changeset. 1.30 + 1.31 +When you commit a change, Mercurial records the name of the branch on 1.32 +which you committed. Once you've switched from the \texttt{default} 1.33 +branch to another and committed, you'll see the name of the new branch 1.34 +show up in the output of \hgcmd{log}, \hgcmd{tip}, and other commands 1.35 +that display the same kind of output. 1.36 +\interaction{branch-named.commit} 1.37 +The \hgcmd{log}-like commands will print the branch name of every 1.38 +changeset that's not on the \texttt{default} branch, so if you never 1.39 +use named branches, you'll never see this information. 1.40 1.41 %%% Local Variables: 1.42 %%% mode: latex
2.1 --- a/en/examples/branch-named Fri Apr 20 14:02:10 2007 -0700 2.2 +++ b/en/examples/branch-named Fri Apr 20 14:35:39 2007 -0700 2.3 @@ -7,4 +7,25 @@ 2.4 2.5 #$ name: branches 2.6 2.7 +hg tip 2.8 hg branches 2.9 + 2.10 +#$ name: branch 2.11 + 2.12 +hg branch 2.13 + 2.14 +#$ name: create 2.15 + 2.16 +hg branch foo 2.17 +hg branch 2.18 + 2.19 +#$ name: status 2.20 + 2.21 +hg status 2.22 +hg tip 2.23 + 2.24 +#$ name: commit 2.25 + 2.26 +echo 'hello again' >> myfile 2.27 +hg commit -m 'Second commit' 2.28 +hg tip