blob: ee4559b6f20d6cfe399c2b7e1b8dd9a1e2aafc7a [file] [log] [blame]
Junio C Hamanof5e375c2005-08-22 23:16:46 -07001git-show-branch(1)
2==================
Junio C Hamanof5e375c2005-08-22 23:16:46 -07003
4NAME
5----
Fredrik Kuivinen7bd7f282006-03-09 17:24:50 +01006git-show-branch - Show branches and their commits
Junio C Hamanof5e375c2005-08-22 23:16:46 -07007
8SYNOPSIS
9--------
Junio C Hamano1aa68d62006-01-11 00:16:42 -080010[verse]
Michael J Gruber995bdc72009-08-05 09:59:19 +020011'git show-branch' [-a|--all] [-r|--remotes] [--topo-order | --date-order]
Mark Lodato73e9da02010-02-16 23:55:58 -050012 [--current] [--color[=<when>] | --no-color] [--sparse]
Dmitry V. Levinbd494fc2006-03-06 03:00:48 +030013 [--more=<n> | --list | --independent | --merge-base]
Stephen Boydb3f298a2009-05-31 23:34:46 -070014 [--no-name | --sha1-name] [--topics]
Štěpán Němec0adda932010-10-08 19:31:17 +020015 [(<rev> | <glob>)...]
Michael J Gruber995bdc72009-08-05 09:59:19 +020016
Jonathan Niederb1889c32008-06-30 01:09:04 -050017'git show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]
Junio C Hamanof5e375c2005-08-22 23:16:46 -070018
19DESCRIPTION
20-----------
Junio C Hamano287f8602005-12-04 15:58:50 -080021
22Shows the commit ancestry graph starting from the commits named
Jeff Kingcc1b8d82010-02-17 20:16:20 -050023with <rev>s or <globs>s (or all refs under refs/heads
24and/or refs/tags) semi-visually.
Junio C Hamano287f8602005-12-04 15:58:50 -080025
26It cannot show more than 29 branches and commits at a time.
27
Junio C Hamano54f97342006-01-11 00:09:16 -080028It uses `showbranch.default` multi-valued configuration items if
29no <rev> nor <glob> is given on the command line.
30
Junio C Hamanof5e375c2005-08-22 23:16:46 -070031
32OPTIONS
33-------
Junio C Hamano287f8602005-12-04 15:58:50 -080034<rev>::
Jonathan Nieder9d83e382010-10-11 11:03:32 -050035 Arbitrary extended SHA1 expression (see linkgit:gitrevisions[7])
Markus Heidelberg04c8ce92008-12-19 13:14:18 +010036 that typically names a branch head or a tag.
Junio C Hamano287f8602005-12-04 15:58:50 -080037
38<glob>::
39 A glob pattern that matches branch or tag names under
Jeff Kingcc1b8d82010-02-17 20:16:20 -050040 refs/. For example, if you have many topic
41 branches under refs/heads/topic, giving
Junio C Hamano287f8602005-12-04 15:58:50 -080042 `topic/*` would show all of them.
Junio C Hamanof5e375c2005-08-22 23:16:46 -070043
Stephan Beyer32402402008-06-08 03:36:09 +020044-r::
45--remotes::
Brian Gernhardtf49006b2006-12-22 08:58:39 -050046 Show the remote-tracking branches.
47
Stephan Beyer32402402008-06-08 03:36:09 +020048-a::
49--all::
Brian Gernhardtf49006b2006-12-22 08:58:39 -050050 Show both remote-tracking branches and local branches.
Junio C Hamanof5e375c2005-08-22 23:16:46 -070051
Junio C Hamano1aa68d62006-01-11 00:16:42 -080052--current::
53 With this option, the command includes the current
54 branch to the list of revs to be shown when it is not
55 given on the command line.
56
Nikolai Weibulld4ce5f72005-12-09 00:28:05 +010057--topo-order::
58 By default, the branches and their commits are shown in
59 reverse chronological order. This option makes them
60 appear in topological order (i.e., descendant commits
61 are shown before their parents).
62
Stephen Boydb3f298a2009-05-31 23:34:46 -070063--date-order::
64 This option is similar to '--topo-order' in the sense that no
65 parent comes before all of its children, but otherwise commits
66 are ordered according to their commit date.
67
Junio C Hamano8048e242006-07-06 19:21:47 -070068--sparse::
69 By default, the output omits merges that are reachable
70 from only one tip being shown. This option makes them
71 visible.
72
Junio C Hamanof5e375c2005-08-22 23:16:46 -070073--more=<n>::
74 Usually the command stops output upon showing the commit
75 that is the common ancestor of all the branches. This
Junio C Hamanof85a4192005-08-29 17:21:06 -070076 flag tells the command to go <n> more common commits
Junio C Hamano1f8af482005-09-09 15:40:45 -070077 beyond that. When <n> is negative, display only the
78 <reference>s given, without showing the commit ancestry
79 tree.
80
81--list::
Junio C Hamano54f97342006-01-11 00:09:16 -080082 Synonym to `--more=-1`
Junio C Hamanof5e375c2005-08-22 23:16:46 -070083
84--merge-base::
Michael J Gruberf621a842009-08-05 09:59:20 +020085 Instead of showing the commit list, determine possible
86 merge bases for the specified commits. All merge bases
87 will be contained in all specified commits. This is
88 different from how linkgit:git-merge-base[1] handles
89 the case of three or more commits.
Junio C Hamanof5e375c2005-08-22 23:16:46 -070090
Junio C Hamano1f8af482005-09-09 15:40:45 -070091--independent::
92 Among the <reference>s given, display only the ones that
93 cannot be reached from any other <reference>.
94
Junio C Hamano013f2762005-10-11 15:22:48 -070095--no-name::
96 Do not show naming strings for each commit.
97
98--sha1-name::
99 Instead of naming the commits using the path to reach
100 them from heads (e.g. "master~2" to mean the grandparent
101 of "master"), name them with the unique prefix of their
102 object names.
103
Brian Gernhardt38c594d2006-12-18 10:48:33 -0500104--topics::
105 Shows only commits that are NOT on the first branch given.
106 This helps track topic branches by hiding any commit that
107 is already in the main line of development. When given
108 "git show-branch --topics master topic1 topic2", this
109 will show the revisions given by "git rev-list {caret}master
110 topic1 topic2"
111
jidanni@jidanni.org5c7eee02009-01-06 11:14:02 +0800112-g::
Junio C Hamano632ac9f2007-02-03 23:31:47 -0800113--reflog[=<n>[,<base>]] [<ref>]::
Junio C Hamano76a44c52007-01-19 01:20:23 -0800114 Shows <n> most recent ref-log entries for the given
115 ref. If <base> is given, <n> entries going back from
Johannes Schindelin084ae0a2007-01-24 15:05:16 +0100116 that entry. <base> can be specified as count or date.
jidanni@jidanni.org5c7eee02009-01-06 11:14:02 +0800117 When no explicit <ref> parameter is given, it defaults to the
Junio C Hamano632ac9f2007-02-03 23:31:47 -0800118 current branch (or `HEAD` if it is detached).
Junio C Hamanoabc8ab12006-12-26 00:11:50 -0800119
Mark Lodato73e9da02010-02-16 23:55:58 -0500120--color[=<when>]::
Markus Heidelbergab07ba22009-04-22 23:41:25 +0200121 Color the status sign (one of these: `*` `!` `+` `-`) of each commit
122 corresponding to the branch it's in.
Mark Lodato73e9da02010-02-16 23:55:58 -0500123 The value must be always (the default), never, or auto.
Markus Heidelbergab07ba22009-04-22 23:41:25 +0200124
125--no-color::
126 Turn off colored output, even when the configuration file gives the
127 default to color output.
Mark Lodato73e9da02010-02-16 23:55:58 -0500128 Same as `--color=never`.
Markus Heidelbergab07ba22009-04-22 23:41:25 +0200129
Junio C Hamano1f8af482005-09-09 15:40:45 -0700130Note that --more, --list, --independent and --merge-base options
131are mutually exclusive.
132
Junio C Hamanof5e375c2005-08-22 23:16:46 -0700133
134OUTPUT
135------
136Given N <references>, the first N lines are the one-line
137description from their commit message. The branch head that is
Junio C Hamanoebedc312006-01-11 14:02:38 -0800138pointed at by $GIT_DIR/HEAD is prefixed with an asterisk `*`
139character while other heads are prefixed with a `!` character.
Junio C Hamanof5e375c2005-08-22 23:16:46 -0700140
141Following these N lines, one-line log for each commit is
142displayed, indented N places. If a commit is on the I-th
Junio C Hamanoebedc312006-01-11 14:02:38 -0800143branch, the I-th indentation character shows a `+` sign;
144otherwise it shows a space. Merge commits are denoted by
145a `-` sign. Each commit shows a short name that
Junio C Hamano89438672005-12-29 01:20:06 -0800146can be used as an extended SHA1 to name that commit.
Junio C Hamanof5e375c2005-08-22 23:16:46 -0700147
148The following example shows three branches, "master", "fixes"
149and "mhf":
150
151------------------------------------------------
152$ git show-branch master fixes mhf
Junio C Hamanoebedc312006-01-11 14:02:38 -0800153* [master] Add 'git show-branch'.
Junio C Hamanof5e375c2005-08-22 23:16:46 -0700154 ! [fixes] Introduce "reset type" flag to "git reset"
155 ! [mhf] Allow "+remote:local" refspec to cause --force when fetching.
156---
157 + [mhf] Allow "+remote:local" refspec to cause --force when fetching.
158 + [mhf~1] Use git-octopus when pulling more than one heads.
159 + [fixes] Introduce "reset type" flag to "git reset"
160 + [mhf~2] "git fetch --force".
161 + [mhf~3] Use .git/remote/origin, not .git/branches/origin.
162 + [mhf~4] Make "git pull" and "git fetch" default to origin
163 + [mhf~5] Infamous 'octopus merge'
164 + [mhf~6] Retire git-parse-remote.
165 + [mhf~7] Multi-head fetch.
166 + [mhf~8] Start adding the $GIT_DIR/remotes/ support.
Junio C Hamanoebedc312006-01-11 14:02:38 -0800167*++ [master] Add 'git show-branch'.
Junio C Hamanof5e375c2005-08-22 23:16:46 -0700168------------------------------------------------
169
170These three branches all forked from a common commit, [master],
Jonathan Niedera5218452010-08-20 05:37:06 -0500171whose commit message is "Add {apostrophe}git show-branch{apostrophe}".
172The "fixes" branch adds one commit "Introduce "reset type" flag to
173"git reset"". The "mhf" branch adds many other commits.
174The current branch is "master".
Junio C Hamanof5e375c2005-08-22 23:16:46 -0700175
Junio C Hamanof5e375c2005-08-22 23:16:46 -0700176
Junio C Hamano54f97342006-01-11 00:09:16 -0800177EXAMPLE
178-------
179
180If you keep your primary branches immediately under
Jeff Kingcc1b8d82010-02-17 20:16:20 -0500181`refs/heads`, and topic branches in subdirectories of
Junio C Hamano54f97342006-01-11 00:09:16 -0800182it, having the following in the configuration file may help:
183
184------------
185[showbranch]
186 default = --topo-order
187 default = heads/*
188
189------------
190
Jon Loeligerbeb8e132006-03-17 18:25:46 -0600191With this, `git show-branch` without extra parameters would show
Junio C Hamano1aa68d62006-01-11 00:16:42 -0800192only the primary branches. In addition, if you happen to be on
193your topic branch, it is shown as well.
Junio C Hamano54f97342006-01-11 00:09:16 -0800194
Junio C Hamano76a44c52007-01-19 01:20:23 -0800195------------
Markus Heidelbergb3eae842008-12-21 02:00:31 -0800196$ git show-branch --reflog="10,1 hour ago" --list master
Junio C Hamano76a44c52007-01-19 01:20:23 -0800197------------
198
199shows 10 reflog entries going back from the tip as of 1 hour ago.
200Without `--list`, the output also shows how these tips are
201topologically related with each other.
Junio C Hamano54f97342006-01-11 00:09:16 -0800202
Junio C Hamanof5e375c2005-08-22 23:16:46 -0700203GIT
204---
Christian Couder9e1f0a82008-06-06 09:07:32 +0200205Part of the linkgit:git[1] suite