Commit 7fa4fbc4 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Update documentation of `git new-branch`

Include verbose output of `git map-branches` to make visible what the
state of the different branches is.

R=iannucci@chromium.org

Change-Id: I4af03ef15b39e4ba84a41c01d1ec801e7bb4bbd6
Reviewed-on: https://chromium-review.googlesource.com/c/1360711Reviewed-by: 's avatarRobbie Iannucci <iannucci@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
parent 03640c7f
......@@ -830,43 +830,51 @@ defaults to <em>origin/master</em>. This is considered to be the <em>root</em>
<div class="sect1">
<h2 id="_example">EXAMPLE</h2>
<div class="sectionbody">
<div class="paragraph"><p></p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ git map-branches</span>
<span style="color: #e42e16"></span><span style="color: #e42e16">origin/master
</span><span style="color: #19c518"></span><span style="color: #19c518"> cool_feature
</span><span style="color: #19c518"></span><span style="color: #19c518"> subfeature
</span><span style="color: #19c518"></span><span style="color: #19c518"> fixit
</span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> frozen_branch *
<div class="paragraph"><p></p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ git map-branches -v</span>
<span style="color: #e42e16"></span><span style="color: #e42e16">origin/master </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">
</span><span style="color: #19c518"></span><span style="color: #19c518"> cool_feature </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 4 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> subfeature </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 2 </span><span style="color: #ffffff">| </span><span style="color: #d338d3">behind 1 </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> fixit </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 2 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> frozen_branch * </span><span style="font-weight: bold; color: #ffffff">[ </span><span style="font-weight: bold; color: #d338d3">ahead 3 </span><span style="font-weight: bold; color: #ffffff"> </span><span style="font-weight: bold; color: #d338d3"> </span><span style="font-weight: bold; color: #ffffff">]
</span><span style="font-weight: bold; color: #ffffff">$ git new-branch independent_cl</span>
<span style="font-weight: bold; color: #ffffff">$ git map-branches</span>
<span style="color: #e42e16"></span><span style="font-weight: bold; color: #e42e16">origin/master
</span><span style="font-weight: bold; color: #19c518"></span><span style="color: #19c518"> cool_feature
</span><span style="color: #19c518"></span><span style="color: #19c518"> subfeature
</span><span style="color: #19c518"></span><span style="color: #19c518"> fixit
</span><span style="color: #19c518"></span><span style="color: #19c518"> frozen_branch
</span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> independent_cl *
<span style="font-weight: bold; color: #ffffff">$ git map-branches -v</span>
<span style="color: #e42e16"></span><span style="font-weight: bold; color: #e42e16">origin/master </span><span style="font-weight: bold; color: #ffffff"> </span><span style="font-weight: bold; color: #d338d3"> </span><span style="font-weight: bold; color: #ffffff"> </span><span style="font-weight: bold; color: #d338d3"> </span><span style="font-weight: bold; color: #ffffff">
</span><span style="font-weight: bold; color: #19c518"></span><span style="color: #19c518"> cool_feature </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 4 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> subfeature </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 2 </span><span style="color: #ffffff">| </span><span style="color: #d338d3">behind 1 </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> fixit </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 2 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> frozen_branch </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 3 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> independent_cl * </span><span style="font-weight: bold; color: #ffffff"> </span><span style="font-weight: bold; color: #d338d3"> </span><span style="font-weight: bold; color: #ffffff"> </span><span style="font-weight: bold; color: #d338d3"> </span><span style="font-weight: bold; color: #ffffff">
</span><span style="font-weight: bold; color: #ffffff">$ vi foo &amp;&amp; git add -A &amp;&amp; git commit -m foo</span>
<span style="font-weight: bold; color: #ffffff">$ git map-branches -v</span>
<span style="color: #e42e16"></span><span style="color: #e42e16">origin/master </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">
</span><span style="color: #19c518"></span><span style="color: #19c518"> cool_feature </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 4 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> subfeature </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 2 </span><span style="color: #ffffff">| </span><span style="color: #d338d3">behind 1 </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> fixit </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 2 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> frozen_branch </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 3 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> independent_cl * </span><span style="font-weight: bold; color: #ffffff">[ </span><span style="font-weight: bold; color: #d338d3">ahead 1 </span><span style="font-weight: bold; color: #ffffff"> </span><span style="font-weight: bold; color: #d338d3"> </span><span style="font-weight: bold; color: #ffffff">]
</span><span style="font-weight: bold; color: #ffffff">$ git new-branch --upstream subfeature nested_cl</span>
<span style="font-weight: bold; color: #ffffff">$ git map-branches</span>
<span style="color: #e42e16"></span><span style="color: #e42e16">origin/master
</span><span style="color: #19c518"></span><span style="color: #19c518"> cool_feature
</span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> subfeature</span> <b>&lt;1&gt;</b><span>
</span><span style="font-weight: bold; color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> nested_cl *
</span><span style="font-weight: bold; color: #19c518"></span><span style="color: #19c518"> fixit
</span><span style="color: #19c518"></span><span style="color: #19c518"> frozen_branch
</span><span style="color: #19c518"></span><span style="color: #19c518"> independent_cl
<span style="font-weight: bold; color: #ffffff">$ git map-branches -v</span>
<span style="color: #e42e16"></span><span style="color: #e42e16">origin/master </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">
</span><span style="color: #19c518"></span><span style="color: #19c518"> cool_feature </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 4 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> subfeature </span><span style="font-weight: bold; color: #ffffff">[ </span><span style="font-weight: bold; color: #d338d3">ahead 2 </span><span style="font-weight: bold; color: #ffffff">| </span><span style="font-weight: bold; color: #d338d3">behind 1 </span><span style="font-weight: bold; color: #ffffff">]</span> <b>&lt;1&gt;</b><span>
</span><span style="font-weight: bold; color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> nested_cl * </span><span style="font-weight: bold; color: #ffffff"> </span><span style="font-weight: bold; color: #d338d3"> </span><span style="font-weight: bold; color: #ffffff"> </span><span style="font-weight: bold; color: #d338d3"> </span><span style="font-weight: bold; color: #ffffff">
</span><span style="font-weight: bold; color: #19c518"></span><span style="color: #19c518"> fixit </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 2 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> frozen_branch </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 3 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> independent_cl </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 1 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="font-weight: bold; color: #ffffff">$ git checkout cool_feature</span>
Switched to branch 'cool_feature'
Your branch is ahead of 'origin/master' by 4 commits.
(use "git push" to publish your local commits)
<span style="font-weight: bold; color: #ffffff">$ git new-branch --upstream_current cl_depends_on_cool_feature</span>
<span style="font-weight: bold; color: #ffffff">$ git map-branches</span>
<span style="color: #e42e16"></span><span style="color: #e42e16">origin/master
</span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> cool_feature
</span><span style="font-weight: bold; color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> cl_depends_on_cool_feature *
</span><span style="font-weight: bold; color: #19c518"></span><span style="color: #19c518"> subfeature
</span><span style="color: #19c518"></span><span style="color: #19c518"> nested_cl
</span><span style="color: #19c518"></span><span style="color: #19c518"> fixit
</span><span style="color: #19c518"></span><span style="color: #19c518"> frozen_branch
</span><span style="color: #19c518"></span><span style="color: #19c518"> independent_cl</span>
<span style="font-weight: bold; color: #ffffff">$ git map-branches -v</span>
<span style="color: #e42e16"></span><span style="color: #e42e16">origin/master </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">
</span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> cool_feature </span><span style="font-weight: bold; color: #ffffff">[ </span><span style="font-weight: bold; color: #d338d3">ahead 4 </span><span style="font-weight: bold; color: #ffffff"> </span><span style="font-weight: bold; color: #d338d3"> </span><span style="font-weight: bold; color: #ffffff">]
</span><span style="font-weight: bold; color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> cl_depends_on_cool_feature * </span><span style="font-weight: bold; color: #ffffff"> </span><span style="font-weight: bold; color: #d338d3"> </span><span style="font-weight: bold; color: #ffffff"> </span><span style="font-weight: bold; color: #d338d3"> </span><span style="font-weight: bold; color: #ffffff">
</span><span style="font-weight: bold; color: #19c518"></span><span style="color: #19c518"> subfeature </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 2 </span><span style="color: #ffffff">| </span><span style="color: #d338d3">behind 1 </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> nested_cl </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">
</span><span style="color: #19c518"></span><span style="color: #19c518"> fixit </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 2 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> frozen_branch </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 3 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]
</span><span style="color: #19c518"></span><span style="color: #19c518"> independent_cl </span><span style="color: #ffffff">[ </span><span style="color: #d338d3">ahead 1 </span><span style="color: #ffffff"> </span><span style="color: #d338d3"> </span><span style="color: #ffffff">]</span>
</code></pre></div></div><p><div class="paragraph"></p></div>
<div class="olist arabic"><ol class="arabic">
<li>
......@@ -917,7 +925,7 @@ from <a href="https://chromium.googlesource.com/chromium/tools/depot_tools.git">
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Last updated 2016-12-15 15:36:52 PST
Last updated 2018-12-05 15:20:42 CET
</div>
</div>
</body>
......
'\" t
.\" Title: git-new-branch
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 12/15/2016
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 12/05/2018
.\" Manual: Chromium depot_tools Manual
.\" Source: depot_tools f72f1ad
.\" Source: depot_tools 0379dbb3
.\" Language: English
.\"
.TH "GIT\-NEW\-BRANCH" "1" "12/15/2016" "depot_tools f72f1ad" "Chromium depot_tools Manual"
.TH "GIT\-NEW\-BRANCH" "1" "12/05/2018" "depot_tools 0379dbb3" "Chromium depot_tools Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
......@@ -77,43 +77,51 @@ This configures the default \fIupstream\fR for all new branches\&. If it is unse
.RS 4
.\}
.nf
\fB$ git map\-branches\fR
\fB$ git map\-branches \-v\fR
origin/master
cool_feature
subfeature
fixit
\fB frozen_branch *
cool_feature [ ahead 4 ]
subfeature [ ahead 2 | behind 1 ]
fixit [ ahead 2 ]
\fB frozen_branch * [ ahead 3 ]
$ git new\-branch independent_cl\fR
\fB$ git map\-branches\fR
\fB$ git map\-branches \-v\fR
\fBorigin/master
\fR cool_feature
subfeature
fixit
frozen_branch
\fR cool_feature [ ahead 4 ]
subfeature [ ahead 2 | behind 1 ]
fixit [ ahead 2 ]
frozen_branch [ ahead 3 ]
\fB independent_cl *
$ vi foo && git add \-A && git commit \-m foo\fR
\fB$ git map\-branches \-v\fR
origin/master
cool_feature [ ahead 4 ]
subfeature [ ahead 2 | behind 1 ]
fixit [ ahead 2 ]
frozen_branch [ ahead 3 ]
\fB independent_cl * [ ahead 1 ]
$ git new\-branch \-\-upstream subfeature nested_cl\fR
\fB$ git map\-branches\fR
\fB$ git map\-branches \-v\fR
origin/master
cool_feature
\fB subfeature \fR\fB\fB(1)\fR\fR\fB
cool_feature [ ahead 4 ]
\fB subfeature [ ahead 2 | behind 1 ] \fR\fB\fB(1)\fR\fR\fB
nested_cl *
\fR fixit
frozen_branch
independent_cl
\fR fixit [ ahead 2 ]
frozen_branch [ ahead 3 ]
independent_cl [ ahead 1 ]
\fB$ git checkout cool_feature\fR
Switched to branch \*(Aqcool_feature\*(Aq
Your branch is ahead of \*(Aqorigin/master\*(Aq by 4 commits\&.
(use "git push" to publish your local commits)
\fB$ git new\-branch \-\-upstream_current cl_depends_on_cool_feature\fR
\fB$ git map\-branches\fR
\fB$ git map\-branches \-v\fR
origin/master
\fB cool_feature
\fB cool_feature [ ahead 4 ]
cl_depends_on_cool_feature *
\fR subfeature
\fR subfeature [ ahead 2 | behind 1 ]
nested_cl
fixit
frozen_branch
independent_cl
fixit [ ahead 2 ]
frozen_branch [ ahead 3 ]
independent_cl [ ahead 1 ]
.fi
.if n \{\
.RE
......
#!/usr/bin/env bash
. demo_repo.sh
run git map-branches
run git map-branches -v
run git new-branch independent_cl
run git map-branches
run git map-branches -v
praw vi foo \&\& git add -A \&\& git commit -m 'foo'
silent echo 'foo' >foo
silent git add -A
silent git commit -m 'foo'
run git map-branches -v
run git new-branch --upstream subfeature nested_cl
callout 3
run git map-branches
run git map-branches -v
run git checkout cool_feature 2>&1
run git new-branch --upstream_current cl_depends_on_cool_feature
run git map-branches
run git map-branches -v
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment