Autogenerated HTML docs for v2.39.0-rc0-49-g083e0
[git-htmldocs.git] / git-branch.html
bloba2f7dafbcac62e3d6e2a3070ae1d3ae66b5646b0
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
7 <meta name="generator" content="AsciiDoc 10.2.0" />
8 <title>git-branch(1)</title>
9 <style type="text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
12 /* Default font. */
13 body {
14 font-family: Georgia,serif;
17 /* Title font. */
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
21 #toctitle,
22 #author, #revnumber, #revdate, #revremark,
23 #footer {
24 font-family: Arial,Helvetica,sans-serif;
27 body {
28 margin: 1em 5% 1em 5%;
31 a {
32 color: blue;
33 text-decoration: underline;
35 a:visited {
36 color: fuchsia;
39 em {
40 font-style: italic;
41 color: navy;
44 strong {
45 font-weight: bold;
46 color: #083194;
49 h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
51 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
56 h1, h2, h3 {
57 border-bottom: 2px solid silver;
59 h2 {
60 padding-top: 0.5em;
62 h3 {
63 float: left;
65 h3 + * {
66 clear: left;
68 h5 {
69 font-size: 1.0em;
72 div.sectionbody {
73 margin-left: 0;
76 hr {
77 border: 1px solid silver;
80 p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
85 ul, ol, li > p {
86 margin-top: 0;
88 ul > li { color: #aaa; }
89 ul > li > * { color: black; }
91 .monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
98 pre {
99 white-space: pre-wrap;
102 #author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
107 #email {
109 #revnumber, #revdate, #revremark {
112 #footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
118 #footer-text {
119 float: left;
120 padding-bottom: 0.5em;
122 #footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
127 #preamble {
128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
134 margin-top: 1.0em;
135 margin-bottom: 1.5em;
137 div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
144 div.content { /* Block element content. */
145 padding: 0;
148 /* Block element titles. */
149 div.title, caption.title {
150 color: #527bbd;
151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
156 div.title + * {
157 margin-top: 0;
160 td div.title:first-child {
161 margin-top: 0.0em;
163 div.content div.title:first-child {
164 margin-top: 0.0em;
166 div.content + div.title {
167 margin-top: 0.0em;
170 div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
177 div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
184 div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
187 margin-right: 10%;
188 border-left: 5px solid #f0f0f0;
189 color: #888;
192 div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
197 div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
201 div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
207 text-align: left;
210 div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
218 div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
223 div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
228 div.imageblock div.content { padding-left: 0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
232 dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
236 dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
242 dd > *:first-child {
243 margin-top: 0.1em;
246 ul, ol {
247 list-style-position: outside;
249 ol.arabic {
250 list-style-type: decimal;
252 ol.loweralpha {
253 list-style-type: lower-alpha;
255 ol.upperalpha {
256 list-style-type: upper-alpha;
258 ol.lowerroman {
259 list-style-type: lower-roman;
261 ol.upperroman {
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
272 tfoot {
273 font-weight: bold;
275 td > div.verse {
276 white-space: pre;
279 div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
283 div.hdlist tr {
284 padding-bottom: 15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
289 td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
295 td.hdlist2 {
296 vertical-align: top;
298 div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
303 .comment {
304 background: yellow;
307 .footnote, .footnoteref {
308 font-size: 0.8em;
311 span.footnote, span.footnoteref {
312 vertical-align: super;
315 #footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
320 #footnotes div.footnote {
321 margin: 0 0 5px 0;
324 #footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
334 div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
339 div.colist td img {
340 margin-top: 0.3em;
343 @media print {
344 #footer-badges { display: none; }
347 #toc {
348 margin-bottom: 2.5em;
351 #toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
363 div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
367 div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
371 div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size: 2em; }
411 span.small { font-size: 0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
421 * xhtml11 specific
423 * */
425 div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
429 div.tableblock > table {
430 border: 3px solid #527bbd;
432 thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
436 p.table {
437 margin-top: 0;
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock > table[frame="void"] {
441 border-style: none;
443 div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
454 * html5 specific
456 * */
458 table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
462 thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
466 p.tableblock {
467 margin-top: 0;
469 table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
498 th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
501 th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
505 th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
517 * manpage specific
519 * */
521 body.manpage h1 {
522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
527 body.manpage h2 {
528 border-style: none;
530 body.manpage div.sectionbody {
531 margin-left: 3em;
534 @media print {
535 body.manpage div#toc { display: none; }
539 </style>
540 <script type="text/javascript">
541 /*<![CDATA[*/
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
552 * Version: 0.4
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
561 // toclevels = 1..4.
562 toc: function (toclevels) {
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
572 return text;
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
586 // browsers).
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
594 iterate(i);
598 iterate(el);
599 return result;
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
610 for (i = 0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute("class")
614 && entry.getAttribute("class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById("content"), toclevels);
623 for (var i = 0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id == "")
626 entry.element.id = "_toc_" + i;
627 var a = document.createElement("a");
628 a.href = "#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement("div");
631 div.appendChild(a);
632 div.className = "toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
659 entriesToRemove.push(entry);
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById("content");
667 var spans = cont.getElementsByTagName("span");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!note) {
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
678 spans[i].innerHTML =
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
681 spans[i].setAttribute("data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
687 var id =spans[i].getAttribute("id");
688 if (id != null) refs["#"+id] = n;
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
694 // Process footnoterefs.
695 for (i=0; i<spans.length; i++) {
696 if (spans[i].className == "footnoteref") {
697 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
698 href = href.match(/#.*/)[0]; // Because IE return full URL.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
708 install: function(toclevels) {
709 var timerId;
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
731 asciidoc.install();
732 /*]]>*/
733 </script>
734 </head>
735 <body class="manpage">
736 <div id="header">
737 <h1>
738 git-branch(1) Manual Page
739 </h1>
740 <h2>NAME</h2>
741 <div class="sectionbody">
742 <p>git-branch -
743 List, create, or delete branches
744 </p>
745 </div>
746 </div>
747 <div id="content">
748 <div class="sect1">
749 <h2 id="_synopsis">SYNOPSIS</h2>
750 <div class="sectionbody">
751 <div class="verseblock">
752 <pre class="content"><em>git branch</em> [--color[=&lt;when&gt;] | --no-color] [--show-current]
753 [-v [--abbrev=&lt;n&gt; | --no-abbrev]]
754 [--column[=&lt;options&gt;] | --no-column] [--sort=&lt;key&gt;]
755 [--merged [&lt;commit&gt;]] [--no-merged [&lt;commit&gt;]]
756 [--contains [&lt;commit&gt;]] [--no-contains [&lt;commit&gt;]]
757 [--points-at &lt;object&gt;] [--format=&lt;format&gt;]
758 [(-r | --remotes) | (-a | --all)]
759 [--list] [&lt;pattern&gt;&#8230;]
760 <em>git branch</em> [--track[=(direct|inherit)] | --no-track] [-f]
761 [--recurse-submodules] &lt;branchname&gt; [&lt;start-point&gt;]
762 <em>git branch</em> (--set-upstream-to=&lt;upstream&gt; | -u &lt;upstream&gt;) [&lt;branchname&gt;]
763 <em>git branch</em> --unset-upstream [&lt;branchname&gt;]
764 <em>git branch</em> (-m | -M) [&lt;oldbranch&gt;] &lt;newbranch&gt;
765 <em>git branch</em> (-c | -C) [&lt;oldbranch&gt;] &lt;newbranch&gt;
766 <em>git branch</em> (-d | -D) [-r] &lt;branchname&gt;&#8230;
767 <em>git branch</em> --edit-description [&lt;branchname&gt;]</pre>
768 <div class="attribution">
769 </div></div>
770 </div>
771 </div>
772 <div class="sect1">
773 <h2 id="_description">DESCRIPTION</h2>
774 <div class="sectionbody">
775 <div class="paragraph"><p>If <code>--list</code> is given, or if there are no non-option arguments, existing
776 branches are listed; the current branch will be highlighted in green and
777 marked with an asterisk. Any branches checked out in linked worktrees will
778 be highlighted in cyan and marked with a plus sign. Option <code>-r</code> causes the
779 remote-tracking branches to be listed,
780 and option <code>-a</code> shows both local and remote branches.</p></div>
781 <div class="paragraph"><p>If a <code>&lt;pattern&gt;</code>
782 is given, it is used as a shell wildcard to restrict the output to
783 matching branches. If multiple patterns are given, a branch is shown if
784 it matches any of the patterns.</p></div>
785 <div class="paragraph"><p>Note that when providing a
786 <code>&lt;pattern&gt;</code>, you must use <code>--list</code>; otherwise the command may be interpreted
787 as branch creation.</p></div>
788 <div class="paragraph"><p>With <code>--contains</code>, shows only the branches that contain the named commit
789 (in other words, the branches whose tip commits are descendants of the
790 named commit), <code>--no-contains</code> inverts it. With <code>--merged</code>, only branches
791 merged into the named commit (i.e. the branches whose tip commits are
792 reachable from the named commit) will be listed. With <code>--no-merged</code> only
793 branches not merged into the named commit will be listed. If the &lt;commit&gt;
794 argument is missing it defaults to <code>HEAD</code> (i.e. the tip of the current
795 branch).</p></div>
796 <div class="paragraph"><p>The command&#8217;s second form creates a new branch head named &lt;branchname&gt;
797 which points to the current <code>HEAD</code>, or &lt;start-point&gt; if given. As a
798 special case, for &lt;start-point&gt;, you may use <code>"A...B"</code> as a shortcut for
799 the merge base of <code>A</code> and <code>B</code> if there is exactly one merge base. You
800 can leave out at most one of <code>A</code> and <code>B</code>, in which case it defaults to
801 <code>HEAD</code>.</p></div>
802 <div class="paragraph"><p>Note that this will create the new branch, but it will not switch the
803 working tree to it; use "git switch &lt;newbranch&gt;" to switch to the
804 new branch.</p></div>
805 <div class="paragraph"><p>When a local branch is started off a remote-tracking branch, Git sets up the
806 branch (specifically the <code>branch.&lt;name&gt;.remote</code> and <code>branch.&lt;name&gt;.merge</code>
807 configuration entries) so that <em>git pull</em> will appropriately merge from
808 the remote-tracking branch. This behavior may be changed via the global
809 <code>branch.autoSetupMerge</code> configuration flag. That setting can be
810 overridden by using the <code>--track</code> and <code>--no-track</code> options, and
811 changed later using <code>git branch --set-upstream-to</code>.</p></div>
812 <div class="paragraph"><p>With a <code>-m</code> or <code>-M</code> option, &lt;oldbranch&gt; will be renamed to &lt;newbranch&gt;.
813 If &lt;oldbranch&gt; had a corresponding reflog, it is renamed to match
814 &lt;newbranch&gt;, and a reflog entry is created to remember the branch
815 renaming. If &lt;newbranch&gt; exists, -M must be used to force the rename
816 to happen.</p></div>
817 <div class="paragraph"><p>The <code>-c</code> and <code>-C</code> options have the exact same semantics as <code>-m</code> and
818 <code>-M</code>, except instead of the branch being renamed, it will be copied to a
819 new name, along with its config and reflog.</p></div>
820 <div class="paragraph"><p>With a <code>-d</code> or <code>-D</code> option, <code>&lt;branchname&gt;</code> will be deleted. You may
821 specify more than one branch for deletion. If the branch currently
822 has a reflog then the reflog will also be deleted.</p></div>
823 <div class="paragraph"><p>Use <code>-r</code> together with <code>-d</code> to delete remote-tracking branches. Note, that it
824 only makes sense to delete remote-tracking branches if they no longer exist
825 in the remote repository or if <em>git fetch</em> was configured not to fetch
826 them again. See also the <em>prune</em> subcommand of <a href="git-remote.html">git-remote(1)</a> for a
827 way to clean up all obsolete remote-tracking branches.</p></div>
828 </div>
829 </div>
830 <div class="sect1">
831 <h2 id="_options">OPTIONS</h2>
832 <div class="sectionbody">
833 <div class="dlist"><dl>
834 <dt class="hdlist1">
836 </dt>
837 <dt class="hdlist1">
838 --delete
839 </dt>
840 <dd>
842 Delete a branch. The branch must be fully merged in its
843 upstream branch, or in <code>HEAD</code> if no upstream was set with
844 <code>--track</code> or <code>--set-upstream-to</code>.
845 </p>
846 </dd>
847 <dt class="hdlist1">
849 </dt>
850 <dd>
852 Shortcut for <code>--delete --force</code>.
853 </p>
854 </dd>
855 <dt class="hdlist1">
856 --create-reflog
857 </dt>
858 <dd>
860 Create the branch&#8217;s reflog. This activates recording of
861 all changes made to the branch ref, enabling use of date
862 based sha1 expressions such as "&lt;branchname&gt;@{yesterday}".
863 Note that in non-bare repositories, reflogs are usually
864 enabled by default by the <code>core.logAllRefUpdates</code> config option.
865 The negated form <code>--no-create-reflog</code> only overrides an earlier
866 <code>--create-reflog</code>, but currently does not negate the setting of
867 <code>core.logAllRefUpdates</code>.
868 </p>
869 </dd>
870 <dt class="hdlist1">
872 </dt>
873 <dt class="hdlist1">
874 --force
875 </dt>
876 <dd>
878 Reset &lt;branchname&gt; to &lt;startpoint&gt;, even if &lt;branchname&gt; exists
879 already. Without <code>-f</code>, <em>git branch</em> refuses to change an existing branch.
880 In combination with <code>-d</code> (or <code>--delete</code>), allow deleting the
881 branch irrespective of its merged status, or whether it even
882 points to a valid commit. In combination with
883 <code>-m</code> (or <code>--move</code>), allow renaming the branch even if the new
884 branch name already exists, the same applies for <code>-c</code> (or <code>--copy</code>).
885 </p>
886 </dd>
887 <dt class="hdlist1">
889 </dt>
890 <dt class="hdlist1">
891 --move
892 </dt>
893 <dd>
895 Move/rename a branch, together with its config and reflog.
896 </p>
897 </dd>
898 <dt class="hdlist1">
900 </dt>
901 <dd>
903 Shortcut for <code>--move --force</code>.
904 </p>
905 </dd>
906 <dt class="hdlist1">
908 </dt>
909 <dt class="hdlist1">
910 --copy
911 </dt>
912 <dd>
914 Copy a branch, together with its config and reflog.
915 </p>
916 </dd>
917 <dt class="hdlist1">
919 </dt>
920 <dd>
922 Shortcut for <code>--copy --force</code>.
923 </p>
924 </dd>
925 <dt class="hdlist1">
926 --color[=&lt;when&gt;]
927 </dt>
928 <dd>
930 Color branches to highlight current, local, and
931 remote-tracking branches.
932 The value must be always (the default), never, or auto.
933 </p>
934 </dd>
935 <dt class="hdlist1">
936 --no-color
937 </dt>
938 <dd>
940 Turn off branch colors, even when the configuration file gives the
941 default to color output.
942 Same as <code>--color=never</code>.
943 </p>
944 </dd>
945 <dt class="hdlist1">
947 </dt>
948 <dt class="hdlist1">
949 --ignore-case
950 </dt>
951 <dd>
953 Sorting and filtering branches are case insensitive.
954 </p>
955 </dd>
956 <dt class="hdlist1">
957 --column[=&lt;options&gt;]
958 </dt>
959 <dt class="hdlist1">
960 --no-column
961 </dt>
962 <dd>
964 Display branch listing in columns. See configuration variable
965 <code>column.branch</code> for option syntax. <code>--column</code> and <code>--no-column</code>
966 without options are equivalent to <em>always</em> and <em>never</em> respectively.
967 </p>
968 <div class="paragraph"><p>This option is only applicable in non-verbose mode.</p></div>
969 </dd>
970 <dt class="hdlist1">
972 </dt>
973 <dt class="hdlist1">
974 --remotes
975 </dt>
976 <dd>
978 List or delete (if used with -d) the remote-tracking branches.
979 Combine with <code>--list</code> to match the optional pattern(s).
980 </p>
981 </dd>
982 <dt class="hdlist1">
984 </dt>
985 <dt class="hdlist1">
986 --all
987 </dt>
988 <dd>
990 List both remote-tracking branches and local branches.
991 Combine with <code>--list</code> to match optional pattern(s).
992 </p>
993 </dd>
994 <dt class="hdlist1">
996 </dt>
997 <dt class="hdlist1">
998 --list
999 </dt>
1000 <dd>
1002 List branches. With optional <code>&lt;pattern&gt;...</code>, e.g. <code>git
1003 branch --list 'maint-*'</code>, list only the branches that match
1004 the pattern(s).
1005 </p>
1006 </dd>
1007 <dt class="hdlist1">
1008 --show-current
1009 </dt>
1010 <dd>
1012 Print the name of the current branch. In detached HEAD state,
1013 nothing is printed.
1014 </p>
1015 </dd>
1016 <dt class="hdlist1">
1018 </dt>
1019 <dt class="hdlist1">
1021 </dt>
1022 <dt class="hdlist1">
1023 --verbose
1024 </dt>
1025 <dd>
1027 When in list mode,
1028 show sha1 and commit subject line for each head, along with
1029 relationship to upstream branch (if any). If given twice, print
1030 the path of the linked worktree (if any) and the name of the upstream
1031 branch, as well (see also <code>git remote show &lt;remote&gt;</code>). Note that the
1032 current worktree&#8217;s HEAD will not have its path printed (it will always
1033 be your current directory).
1034 </p>
1035 </dd>
1036 <dt class="hdlist1">
1038 </dt>
1039 <dt class="hdlist1">
1040 --quiet
1041 </dt>
1042 <dd>
1044 Be more quiet when creating or deleting a branch, suppressing
1045 non-error messages.
1046 </p>
1047 </dd>
1048 <dt class="hdlist1">
1049 --abbrev=&lt;n&gt;
1050 </dt>
1051 <dd>
1053 In the verbose listing that show the commit object name,
1054 show the shortest prefix that is at least <em>&lt;n&gt;</em> hexdigits
1055 long that uniquely refers the object.
1056 The default value is 7 and can be overridden by the <code>core.abbrev</code>
1057 config option.
1058 </p>
1059 </dd>
1060 <dt class="hdlist1">
1061 --no-abbrev
1062 </dt>
1063 <dd>
1065 Display the full sha1s in the output listing rather than abbreviating them.
1066 </p>
1067 </dd>
1068 <dt class="hdlist1">
1070 </dt>
1071 <dt class="hdlist1">
1072 --track[=(direct|inherit)]
1073 </dt>
1074 <dd>
1076 When creating a new branch, set up <code>branch.&lt;name&gt;.remote</code> and
1077 <code>branch.&lt;name&gt;.merge</code> configuration entries to set "upstream" tracking
1078 configuration for the new branch. This
1079 configuration will tell git to show the relationship between the
1080 two branches in <code>git status</code> and <code>git branch -v</code>. Furthermore,
1081 it directs <code>git pull</code> without arguments to pull from the
1082 upstream when the new branch is checked out.
1083 </p>
1084 <div class="paragraph"><p>The exact upstream branch is chosen depending on the optional argument:
1085 <code>-t</code>, <code>--track</code>, or <code>--track=direct</code> means to use the start-point branch
1086 itself as the upstream; <code>--track=inherit</code> means to copy the upstream
1087 configuration of the start-point branch.</p></div>
1088 <div class="paragraph"><p>The branch.autoSetupMerge configuration variable specifies how <code>git switch</code>,
1089 <code>git checkout</code> and <code>git branch</code> should behave when neither <code>--track</code> nor
1090 <code>--no-track</code> are specified:</p></div>
1091 <div class="paragraph"><p>The default option, <code>true</code>, behaves as though <code>--track=direct</code>
1092 were given whenever the start-point is a remote-tracking branch.
1093 <code>false</code> behaves as if <code>--no-track</code> were given. <code>always</code> behaves as though
1094 <code>--track=direct</code> were given. <code>inherit</code> behaves as though <code>--track=inherit</code>
1095 were given. <code>simple</code> behaves as though <code>--track=direct</code> were given only when
1096 the start-point is a remote-tracking branch and the new branch has the same
1097 name as the remote branch.</p></div>
1098 <div class="paragraph"><p>See <a href="git-pull.html">git-pull(1)</a> and <a href="git-config.html">git-config(1)</a> for additional discussion on
1099 how the <code>branch.&lt;name&gt;.remote</code> and <code>branch.&lt;name&gt;.merge</code> options are used.</p></div>
1100 </dd>
1101 <dt class="hdlist1">
1102 --no-track
1103 </dt>
1104 <dd>
1106 Do not set up "upstream" configuration, even if the
1107 branch.autoSetupMerge configuration variable is set.
1108 </p>
1109 </dd>
1110 <dt class="hdlist1">
1111 --recurse-submodules
1112 </dt>
1113 <dd>
1115 THIS OPTION IS EXPERIMENTAL! Causes the current command to
1116 recurse into submodules if <code>submodule.propagateBranches</code> is
1117 enabled. See <code>submodule.propagateBranches</code> in
1118 <a href="git-config.html">git-config(1)</a>. Currently, only branch creation is
1119 supported.
1120 </p>
1121 <div class="paragraph"><p>When used in branch creation, a new branch &lt;branchname&gt; will be created
1122 in the superproject and all of the submodules in the superproject&#8217;s
1123 &lt;start-point&gt;. In submodules, the branch will point to the submodule
1124 commit in the superproject&#8217;s &lt;start-point&gt; but the branch&#8217;s tracking
1125 information will be set up based on the submodule&#8217;s branches and remotes
1126 e.g. <code>git branch --recurse-submodules topic origin/main</code> will create the
1127 submodule branch "topic" that points to the submodule commit in the
1128 superproject&#8217;s "origin/main", but tracks the submodule&#8217;s "origin/main".</p></div>
1129 </dd>
1130 <dt class="hdlist1">
1131 --set-upstream
1132 </dt>
1133 <dd>
1135 As this option had confusing syntax, it is no longer supported.
1136 Please use <code>--track</code> or <code>--set-upstream-to</code> instead.
1137 </p>
1138 </dd>
1139 <dt class="hdlist1">
1140 -u &lt;upstream&gt;
1141 </dt>
1142 <dt class="hdlist1">
1143 --set-upstream-to=&lt;upstream&gt;
1144 </dt>
1145 <dd>
1147 Set up &lt;branchname&gt;'s tracking information so &lt;upstream&gt; is
1148 considered &lt;branchname&gt;'s upstream branch. If no &lt;branchname&gt;
1149 is specified, then it defaults to the current branch.
1150 </p>
1151 </dd>
1152 <dt class="hdlist1">
1153 --unset-upstream
1154 </dt>
1155 <dd>
1157 Remove the upstream information for &lt;branchname&gt;. If no branch
1158 is specified it defaults to the current branch.
1159 </p>
1160 </dd>
1161 <dt class="hdlist1">
1162 --edit-description
1163 </dt>
1164 <dd>
1166 Open an editor and edit the text to explain what the branch is
1167 for, to be used by various other commands (e.g. <code>format-patch</code>,
1168 <code>request-pull</code>, and <code>merge</code> (if enabled)). Multi-line explanations
1169 may be used.
1170 </p>
1171 </dd>
1172 <dt class="hdlist1">
1173 --contains [&lt;commit&gt;]
1174 </dt>
1175 <dd>
1177 Only list branches which contain the specified commit (HEAD
1178 if not specified). Implies <code>--list</code>.
1179 </p>
1180 </dd>
1181 <dt class="hdlist1">
1182 --no-contains [&lt;commit&gt;]
1183 </dt>
1184 <dd>
1186 Only list branches which don&#8217;t contain the specified commit
1187 (HEAD if not specified). Implies <code>--list</code>.
1188 </p>
1189 </dd>
1190 <dt class="hdlist1">
1191 --merged [&lt;commit&gt;]
1192 </dt>
1193 <dd>
1195 Only list branches whose tips are reachable from the
1196 specified commit (HEAD if not specified). Implies <code>--list</code>.
1197 </p>
1198 </dd>
1199 <dt class="hdlist1">
1200 --no-merged [&lt;commit&gt;]
1201 </dt>
1202 <dd>
1204 Only list branches whose tips are not reachable from the
1205 specified commit (HEAD if not specified). Implies <code>--list</code>.
1206 </p>
1207 </dd>
1208 <dt class="hdlist1">
1209 &lt;branchname&gt;
1210 </dt>
1211 <dd>
1213 The name of the branch to create or delete.
1214 The new branch name must pass all checks defined by
1215 <a href="git-check-ref-format.html">git-check-ref-format(1)</a>. Some of these checks
1216 may restrict the characters allowed in a branch name.
1217 </p>
1218 </dd>
1219 <dt class="hdlist1">
1220 &lt;start-point&gt;
1221 </dt>
1222 <dd>
1224 The new branch head will point to this commit. It may be
1225 given as a branch name, a commit-id, or a tag. If this
1226 option is omitted, the current HEAD will be used instead.
1227 </p>
1228 </dd>
1229 <dt class="hdlist1">
1230 &lt;oldbranch&gt;
1231 </dt>
1232 <dd>
1234 The name of an existing branch to rename.
1235 </p>
1236 </dd>
1237 <dt class="hdlist1">
1238 &lt;newbranch&gt;
1239 </dt>
1240 <dd>
1242 The new name for an existing branch. The same restrictions as for
1243 &lt;branchname&gt; apply.
1244 </p>
1245 </dd>
1246 <dt class="hdlist1">
1247 --sort=&lt;key&gt;
1248 </dt>
1249 <dd>
1251 Sort based on the key given. Prefix <code>-</code> to sort in descending
1252 order of the value. You may use the --sort=&lt;key&gt; option
1253 multiple times, in which case the last key becomes the primary
1254 key. The keys supported are the same as those in <code>git
1255 for-each-ref</code>. Sort order defaults to the value configured for the
1256 <code>branch.sort</code> variable if exists, or to sorting based on the
1257 full refname (including <code>refs/...</code> prefix). This lists
1258 detached HEAD (if present) first, then local branches and
1259 finally remote-tracking branches. See <a href="git-config.html">git-config(1)</a>.
1260 </p>
1261 </dd>
1262 <dt class="hdlist1">
1263 --points-at &lt;object&gt;
1264 </dt>
1265 <dd>
1267 Only list branches of the given object.
1268 </p>
1269 </dd>
1270 <dt class="hdlist1">
1271 --format &lt;format&gt;
1272 </dt>
1273 <dd>
1275 A string that interpolates <code>%(fieldname)</code> from a branch ref being shown
1276 and the object it points at. The format is the same as
1277 that of <a href="git-for-each-ref.html">git-for-each-ref(1)</a>.
1278 </p>
1279 </dd>
1280 </dl></div>
1281 </div>
1282 </div>
1283 <div class="sect1">
1284 <h2 id="_configuration">CONFIGURATION</h2>
1285 <div class="sectionbody">
1286 <div class="paragraph"><p><code>pager.branch</code> is only respected when listing branches, i.e., when
1287 <code>--list</code> is used or implied. The default is to use a pager.
1288 See <a href="git-config.html">git-config(1)</a>.</p></div>
1289 <div class="paragraph"><p>Everything above this line in this section isn&#8217;t included from the
1290 <a href="git-config.html">git-config(1)</a> documentation. The content that follows is the
1291 same as what&#8217;s found there:</p></div>
1292 <div class="dlist"><dl>
1293 <dt class="hdlist1">
1294 branch.autoSetupMerge
1295 </dt>
1296 <dd>
1298 Tells <em>git branch</em>, <em>git switch</em> and <em>git checkout</em> to set up new branches
1299 so that <a href="git-pull.html">git-pull(1)</a> will appropriately merge from the
1300 starting point branch. Note that even if this option is not set,
1301 this behavior can be chosen per-branch using the <code>--track</code>
1302 and <code>--no-track</code> options. The valid settings are: <code>false</code>&#8201;&#8212;&#8201;no
1303 automatic setup is done; <code>true</code>&#8201;&#8212;&#8201;automatic setup is done when the
1304 starting point is a remote-tracking branch; <code>always</code>&#8201;&#8212;&#8201; automatic setup is done when the starting point is either a
1305 local branch or remote-tracking branch; <code>inherit</code>&#8201;&#8212;&#8201;if the starting point
1306 has a tracking configuration, it is copied to the new
1307 branch; <code>simple</code>&#8201;&#8212;&#8201;automatic setup is done only when the starting point
1308 is a remote-tracking branch and the new branch has the same name as the
1309 remote branch. This option defaults to true.
1310 </p>
1311 </dd>
1312 <dt class="hdlist1">
1313 branch.autoSetupRebase
1314 </dt>
1315 <dd>
1317 When a new branch is created with <em>git branch</em>, <em>git switch</em> or <em>git checkout</em>
1318 that tracks another branch, this variable tells Git to set
1319 up pull to rebase instead of merge (see "branch.&lt;name&gt;.rebase").
1320 When <code>never</code>, rebase is never automatically set to true.
1321 When <code>local</code>, rebase is set to true for tracked branches of
1322 other local branches.
1323 When <code>remote</code>, rebase is set to true for tracked branches of
1324 remote-tracking branches.
1325 When <code>always</code>, rebase will be set to true for all tracking
1326 branches.
1327 See "branch.autoSetupMerge" for details on how to set up a
1328 branch to track another branch.
1329 This option defaults to never.
1330 </p>
1331 </dd>
1332 <dt class="hdlist1">
1333 branch.sort
1334 </dt>
1335 <dd>
1337 This variable controls the sort ordering of branches when displayed by
1338 <a href="git-branch.html">git-branch(1)</a>. Without the "--sort=&lt;value&gt;" option provided, the
1339 value of this variable will be used as the default.
1340 See <a href="git-for-each-ref.html">git-for-each-ref(1)</a> field names for valid values.
1341 </p>
1342 </dd>
1343 <dt class="hdlist1">
1344 branch.&lt;name&gt;.remote
1345 </dt>
1346 <dd>
1348 When on branch &lt;name&gt;, it tells <em>git fetch</em> and <em>git push</em>
1349 which remote to fetch from/push to. The remote to push to
1350 may be overridden with <code>remote.pushDefault</code> (for all branches).
1351 The remote to push to, for the current branch, may be further
1352 overridden by <code>branch.&lt;name&gt;.pushRemote</code>. If no remote is
1353 configured, or if you are not on any branch and there is more than
1354 one remote defined in the repository, it defaults to <code>origin</code> for
1355 fetching and <code>remote.pushDefault</code> for pushing.
1356 Additionally, <code>.</code> (a period) is the current local repository
1357 (a dot-repository), see <code>branch.&lt;name&gt;.merge</code>'s final note below.
1358 </p>
1359 </dd>
1360 <dt class="hdlist1">
1361 branch.&lt;name&gt;.pushRemote
1362 </dt>
1363 <dd>
1365 When on branch &lt;name&gt;, it overrides <code>branch.&lt;name&gt;.remote</code> for
1366 pushing. It also overrides <code>remote.pushDefault</code> for pushing
1367 from branch &lt;name&gt;. When you pull from one place (e.g. your
1368 upstream) and push to another place (e.g. your own publishing
1369 repository), you would want to set <code>remote.pushDefault</code> to
1370 specify the remote to push to for all branches, and use this
1371 option to override it for a specific branch.
1372 </p>
1373 </dd>
1374 <dt class="hdlist1">
1375 branch.&lt;name&gt;.merge
1376 </dt>
1377 <dd>
1379 Defines, together with branch.&lt;name&gt;.remote, the upstream branch
1380 for the given branch. It tells <em>git fetch</em>/<em>git pull</em>/<em>git rebase</em> which
1381 branch to merge and can also affect <em>git push</em> (see push.default).
1382 When in branch &lt;name&gt;, it tells <em>git fetch</em> the default
1383 refspec to be marked for merging in FETCH_HEAD. The value is
1384 handled like the remote part of a refspec, and must match a
1385 ref which is fetched from the remote given by
1386 "branch.&lt;name&gt;.remote".
1387 The merge information is used by <em>git pull</em> (which at first calls
1388 <em>git fetch</em>) to lookup the default branch for merging. Without
1389 this option, <em>git pull</em> defaults to merge the first refspec fetched.
1390 Specify multiple values to get an octopus merge.
1391 If you wish to setup <em>git pull</em> so that it merges into &lt;name&gt; from
1392 another branch in the local repository, you can point
1393 branch.&lt;name&gt;.merge to the desired branch, and use the relative path
1394 setting <code>.</code> (a period) for branch.&lt;name&gt;.remote.
1395 </p>
1396 </dd>
1397 <dt class="hdlist1">
1398 branch.&lt;name&gt;.mergeOptions
1399 </dt>
1400 <dd>
1402 Sets default options for merging into branch &lt;name&gt;. The syntax and
1403 supported options are the same as those of <a href="git-merge.html">git-merge(1)</a>, but
1404 option values containing whitespace characters are currently not
1405 supported.
1406 </p>
1407 </dd>
1408 <dt class="hdlist1">
1409 branch.&lt;name&gt;.rebase
1410 </dt>
1411 <dd>
1413 When true, rebase the branch &lt;name&gt; on top of the fetched branch,
1414 instead of merging the default branch from the default remote when
1415 "git pull" is run. See "pull.rebase" for doing this in a non
1416 branch-specific manner.
1417 </p>
1418 <div class="paragraph"><p>When <code>merges</code> (or just <em>m</em>), pass the <code>--rebase-merges</code> option to <em>git rebase</em>
1419 so that the local merge commits are included in the rebase (see
1420 <a href="git-rebase.html">git-rebase(1)</a> for details).</p></div>
1421 <div class="paragraph"><p>When the value is <code>interactive</code> (or just <em>i</em>), the rebase is run in interactive
1422 mode.</p></div>
1423 <div class="paragraph"><p><strong>NOTE</strong>: this is a possibly dangerous operation; do <strong>not</strong> use
1424 it unless you understand the implications (see <a href="git-rebase.html">git-rebase(1)</a>
1425 for details).</p></div>
1426 </dd>
1427 <dt class="hdlist1">
1428 branch.&lt;name&gt;.description
1429 </dt>
1430 <dd>
1432 Branch description, can be edited with
1433 <code>git branch --edit-description</code>. Branch description is
1434 automatically added in the format-patch cover letter or
1435 request-pull summary.
1436 </p>
1437 </dd>
1438 </dl></div>
1439 </div>
1440 </div>
1441 <div class="sect1">
1442 <h2 id="_examples">EXAMPLES</h2>
1443 <div class="sectionbody">
1444 <div class="dlist"><dl>
1445 <dt class="hdlist1">
1446 Start development from a known tag
1447 </dt>
1448 <dd>
1449 <div class="listingblock">
1450 <div class="content">
1451 <pre><code>$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
1452 $ cd my2.6
1453 $ git branch my2.6.14 v2.6.14 <b>&lt;1&gt;</b>
1454 $ git switch my2.6.14</code></pre>
1455 </div></div>
1456 <div class="colist arabic"><ol>
1457 <li>
1459 This step and the next one could be combined into a single step with
1460 "checkout -b my2.6.14 v2.6.14".
1461 </p>
1462 </li>
1463 </ol></div>
1464 </dd>
1465 <dt class="hdlist1">
1466 Delete an unneeded branch
1467 </dt>
1468 <dd>
1469 <div class="listingblock">
1470 <div class="content">
1471 <pre><code>$ git clone git://git.kernel.org/.../git.git my.git
1472 $ cd my.git
1473 $ git branch -d -r origin/todo origin/html origin/man <b>&lt;1&gt;</b>
1474 $ git branch -D test <b>&lt;2&gt;</b></code></pre>
1475 </div></div>
1476 <div class="colist arabic"><ol>
1477 <li>
1479 Delete the remote-tracking branches "todo", "html" and "man". The next
1480 <em>fetch</em> or <em>pull</em> will create them again unless you configure them not to.
1481 See <a href="git-fetch.html">git-fetch(1)</a>.
1482 </p>
1483 </li>
1484 <li>
1486 Delete the "test" branch even if the "master" branch (or whichever branch
1487 is currently checked out) does not have all commits from the test branch.
1488 </p>
1489 </li>
1490 </ol></div>
1491 </dd>
1492 <dt class="hdlist1">
1493 Listing branches from a specific remote
1494 </dt>
1495 <dd>
1496 <div class="listingblock">
1497 <div class="content">
1498 <pre><code>$ git branch -r -l '&lt;remote&gt;/&lt;pattern&gt;' <b>&lt;1&gt;</b>
1499 $ git for-each-ref 'refs/remotes/&lt;remote&gt;/&lt;pattern&gt;' <b>&lt;2&gt;</b></code></pre>
1500 </div></div>
1501 <div class="colist arabic"><ol>
1502 <li>
1504 Using <code>-a</code> would conflate &lt;remote&gt; with any local branches you happen to
1505 have been prefixed with the same &lt;remote&gt; pattern.
1506 </p>
1507 </li>
1508 <li>
1510 <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>
1511 </p>
1512 </li>
1513 </ol></div>
1514 </dd>
1515 </dl></div>
1516 <div class="paragraph"><p>Patterns will normally need quoting.</p></div>
1517 </div>
1518 </div>
1519 <div class="sect1">
1520 <h2 id="_notes">NOTES</h2>
1521 <div class="sectionbody">
1522 <div class="paragraph"><p>If you are creating a branch that you want to switch to immediately,
1523 it is easier to use the "git switch" command with its <code>-c</code> option to
1524 do the same thing with a single command.</p></div>
1525 <div class="paragraph"><p>The options <code>--contains</code>, <code>--no-contains</code>, <code>--merged</code> and <code>--no-merged</code>
1526 serve four related but different purposes:</p></div>
1527 <div class="ulist"><ul>
1528 <li>
1530 <code>--contains &lt;commit&gt;</code> is used to find all branches which will need
1531 special attention if &lt;commit&gt; were to be rebased or amended, since those
1532 branches contain the specified &lt;commit&gt;.
1533 </p>
1534 </li>
1535 <li>
1537 <code>--no-contains &lt;commit&gt;</code> is the inverse of that, i.e. branches that don&#8217;t
1538 contain the specified &lt;commit&gt;.
1539 </p>
1540 </li>
1541 <li>
1543 <code>--merged</code> is used to find all branches which can be safely deleted,
1544 since those branches are fully contained by HEAD.
1545 </p>
1546 </li>
1547 <li>
1549 <code>--no-merged</code> is used to find branches which are candidates for merging
1550 into HEAD, since those branches are not fully contained by HEAD.
1551 </p>
1552 </li>
1553 </ul></div>
1554 <div class="paragraph"><p>When combining multiple <code>--contains</code> and <code>--no-contains</code> filters, only
1555 references that contain at least one of the <code>--contains</code> commits and
1556 contain none of the <code>--no-contains</code> commits are shown.</p></div>
1557 <div class="paragraph"><p>When combining multiple <code>--merged</code> and <code>--no-merged</code> filters, only
1558 references that are reachable from at least one of the <code>--merged</code>
1559 commits and from none of the <code>--no-merged</code> commits are shown.</p></div>
1560 </div>
1561 </div>
1562 <div class="sect1">
1563 <h2 id="_see_also">SEE ALSO</h2>
1564 <div class="sectionbody">
1565 <div class="paragraph"><p><a href="git-check-ref-format.html">git-check-ref-format(1)</a>,
1566 <a href="git-fetch.html">git-fetch(1)</a>,
1567 <a href="git-remote.html">git-remote(1)</a>,
1568 <a href="user-manual.html#what-is-a-branch">&#8220;Understanding history: What is
1569 a branch?&#8221;</a> in the Git User&#8217;s Manual.</p></div>
1570 </div>
1571 </div>
1572 <div class="sect1">
1573 <h2 id="_git">GIT</h2>
1574 <div class="sectionbody">
1575 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1576 </div>
1577 </div>
1578 </div>
1579 <div id="footnotes"><hr /></div>
1580 <div id="footer">
1581 <div id="footer-text">
1582 Last updated
1583 2022-09-15 05:23:11 JST
1584 </div>
1585 </div>
1586 </body>
1587 </html>