summaryrefslogtreecommitdiffstats
path: root/git-branch.html
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-07-09 19:54:04 -0700
committerJunio C Hamano <gitster@pobox.com>2019-07-09 19:54:04 -0700
commitc9f11c2b3a739e3e249b9e7711bf1ed76ef3c6db (patch)
tree06ddfc72dff8e370e395a3acc692c8ab48147227 /git-branch.html
parentd0a9940c76b71c9df840a098a423d3400779d83c (diff)
downloadgit-htmldocs-c9f11c2b3a739e3e249b9e7711bf1ed76ef3c6db.tar.gz
Autogenerated HTML docs for v2.22.0-428-g6d5b2
Diffstat (limited to 'git-branch.html')
-rw-r--r--git-branch.html68
1 files changed, 51 insertions, 17 deletions
diff --git a/git-branch.html b/git-branch.html
index 72a124e46..5ff9f983c 100644
--- a/git-branch.html
+++ b/git-branch.html
@@ -749,12 +749,14 @@ git-branch(1) Manual Page
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>git branch</em> [--color[=&lt;when&gt;] | --no-color] [-r | -a]
- [--list] [--show-current] [-v [--abbrev=&lt;length&gt; | --no-abbrev]]
+<pre class="content"><em>git branch</em> [--color[=&lt;when&gt;] | --no-color] [--show-current]
+ [-v [--abbrev=&lt;length&gt; | --no-abbrev]]
[--column[=&lt;options&gt;] | --no-column] [--sort=&lt;key&gt;]
[(--merged | --no-merged) [&lt;commit&gt;]]
[--contains [&lt;commit]] [--no-contains [&lt;commit&gt;]]
- [--points-at &lt;object&gt;] [--format=&lt;format&gt;] [&lt;pattern&gt;&#8230;]
+ [--points-at &lt;object&gt;] [--format=&lt;format&gt;]
+ [(-r | --remotes) | (-a | --all)]
+ [--list] [&lt;pattern&gt;&#8230;]
<em>git branch</em> [--track | --no-track] [-f] &lt;branchname&gt; [&lt;start-point&gt;]
<em>git branch</em> (--set-upstream-to=&lt;upstream&gt; | -u &lt;upstream&gt;) [&lt;branchname&gt;]
<em>git branch</em> --unset-upstream [&lt;branchname&gt;]
@@ -770,13 +772,17 @@ git-branch(1) Manual Page
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph"><p>If <code>--list</code> is given, or if there are no non-option arguments, existing
-branches are listed; the current branch will be highlighted with an
-asterisk. Option <code>-r</code> causes the remote-tracking branches to be listed,
-and option <code>-a</code> shows both local and remote branches. If a <code>&lt;pattern&gt;</code>
+branches are listed; the current branch will be highlighted in green and
+marked with an asterisk. Any branches checked out in linked worktrees will
+be highlighted in cyan and marked with a plus sign. Option <code>-r</code> causes the
+remote-tracking branches to be listed,
+and option <code>-a</code> shows both local and remote branches.</p></div>
+<div class="paragraph"><p>If a <code>&lt;pattern&gt;</code>
is given, it is used as a shell wildcard to restrict the output to
matching branches. If multiple patterns are given, a branch is shown if
-it matches any of the patterns. Note that when providing a
-<code>&lt;pattern&gt;</code>, you must use <code>--list</code>; otherwise the command is interpreted
+it matches any of the patterns.</p></div>
+<div class="paragraph"><p>Note that when providing a
+<code>&lt;pattern&gt;</code>, you must use <code>--list</code>; otherwise the command may be interpreted
as branch creation.</p></div>
<div class="paragraph"><p>With <code>--contains</code>, shows only the branches that contain the named commit
(in other words, the branches whose tip commits are descendants of the
@@ -793,7 +799,7 @@ the merge base of <code>A</code> and <code>B</code> if there is exactly one merg
can leave out at most one of <code>A</code> and <code>B</code>, in which case it defaults to
<code>HEAD</code>.</p></div>
<div class="paragraph"><p>Note that this will create the new branch, but it will not switch the
-working tree to it; use "git checkout &lt;newbranch&gt;" to switch to the
+working tree to it; use "git switch &lt;newbranch&gt;" to switch to the
new branch.</p></div>
<div class="paragraph"><p>When a local branch is started off a remote-tracking branch, Git sets up the
branch (specifically the <code>branch.&lt;name&gt;.remote</code> and <code>branch.&lt;name&gt;.merge</code>
@@ -968,6 +974,7 @@ way to clean up all obsolete remote-tracking branches.</p></div>
<dd>
<p>
List or delete (if used with -d) the remote-tracking branches.
+ Combine with <code>--list</code> to match the optional pattern(s).
</p>
</dd>
<dt class="hdlist1">
@@ -979,6 +986,7 @@ way to clean up all obsolete remote-tracking branches.</p></div>
<dd>
<p>
List both remote-tracking branches and local branches.
+ Combine with <code>--list</code> to match optional pattern(s).
</p>
</dd>
<dt class="hdlist1">
@@ -1017,8 +1025,10 @@ way to clean up all obsolete remote-tracking branches.</p></div>
When in list mode,
show sha1 and commit subject line for each head, along with
relationship to upstream branch (if any). If given twice, print
- the name of the upstream branch, as well (see also <code>git remote
- show &lt;remote&gt;</code>).
+ the path of the linked worktree (if any) and the name of the upstream
+ branch, as well (see also <code>git remote show &lt;remote&gt;</code>). Note that the
+ current worktree&#8217;s HEAD will not have its path printed (it will always
+ be your current directory).
</p>
</dd>
<dt class="hdlist1">
@@ -1069,7 +1079,7 @@ way to clean up all obsolete remote-tracking branches.</p></div>
</p>
<div class="paragraph"><p>This behavior is the default when the start point is a remote-tracking branch.
Set the branch.autoSetupMerge configuration variable to <code>false</code> if you
-want <code>git checkout</code> and <code>git branch</code> to always behave as if <code>--no-track</code>
+want <code>git switch</code>, <code>git checkout</code> and <code>git branch</code> to always behave as if <code>--no-track</code>
were given. Set it to <code>always</code> if you want this behavior when the
start-point is either a local or remote-tracking branch.</p></div>
</dd>
@@ -1258,7 +1268,7 @@ Start development from a known tag
<pre><code>$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
$ cd my2.6
$ git branch my2.6.14 v2.6.14 <b>&lt;1&gt;</b>
-$ git checkout my2.6.14</code></pre>
+$ git switch my2.6.14</code></pre>
</div></div>
<div class="colist arabic"><ol>
<li>
@@ -1296,15 +1306,39 @@ Delete the "test" branch even if the "master" branch (or whichever branch
</li>
</ol></div>
</dd>
+<dt class="hdlist1">
+Listing branches from a specific remote
+</dt>
+<dd>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ git branch -r -l '&lt;remote&gt;/&lt;pattern&gt;' <b>&lt;1&gt;</b>
+$ git for-each-ref 'refs/remotes/&lt;remote&gt;/&lt;pattern&gt;' <b>&lt;2&gt;</b></code></pre>
+</div></div>
+<div class="colist arabic"><ol>
+<li>
+<p>
+Using <code>-a</code> would conflate &lt;remote&gt; with any local branches you happen to
+ have been prefixed with the same &lt;remote&gt; pattern.
+</p>
+</li>
+<li>
+<p>
+<code>for-each-ref</code> can take a wide range of options. See <a href="git-for-each-ref.html">git-for-each-ref(1)</a>
+</p>
+</li>
+</ol></div>
+</dd>
</dl></div>
+<div class="paragraph"><p>Patterns will normally need quoting.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_notes">NOTES</h2>
<div class="sectionbody">
-<div class="paragraph"><p>If you are creating a branch that you want to checkout immediately, it is
-easier to use the git checkout command with its <code>-b</code> option to create
-a branch and check it out with a single command.</p></div>
+<div class="paragraph"><p>If you are creating a branch that you want to switch to immediately,
+it is easier to use the "git switch" command with its <code>-c</code> option to
+do the same thing with a single command.</p></div>
<div class="paragraph"><p>The options <code>--contains</code>, <code>--no-contains</code>, <code>--merged</code> and <code>--no-merged</code>
serve four related but different purposes:</p></div>
<div class="ulist"><ul>
@@ -1357,7 +1391,7 @@ a branch?&#8221;</a> in the Git User&#8217;s Manual.</p></div>
<div id="footer">
<div id="footer-text">
Last updated
- 2019-05-19 01:58:26 PDT
+ 2019-07-09 19:51:04 PDT
</div>
</div>
</body>