blob: a515648ab018b849897dd3506183f57359be598a [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-show-branch(1)
2==================
3
4NAME
5----
Junio C Hamano01078922006-03-10 00:31:476git-show-branch - Show branches and their commits
Junio C Hamano1a4e8412005-12-27 08:17:237
8SYNOPSIS
9--------
Junio C Hamano38064d52006-01-15 10:13:4910[verse]
Junio C Hamanofd9274d2009-08-05 21:21:3911'git show-branch' [-a|--all] [-r|--remotes] [--topo-order | --date-order]
Junio C Hamano4aa0bcc2010-03-03 05:13:1212[--current] [--color[=<when>] | --no-color] [--sparse]
Junio C Hamano2bb13102006-03-06 07:10:2113[--more=<n> | --list | --independent | --merge-base]
Junio C Hamanocca56612009-06-03 08:27:3314[--no-name | --sha1-name] [--topics]
Junio C Hamanod2179ef2010-10-22 04:12:1715[(<rev> | <glob>)...]
Junio C Hamanofce7c7e2008-07-02 03:06:3816'git show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]
Junio C Hamano1a4e8412005-12-27 08:17:2317
18DESCRIPTION
19-----------
20
21Shows the commit ancestry graph starting from the commits named
Junio C Hamano4fdccb22010-02-19 09:58:1422with <rev>s or <globs>s (or all refs under refs/heads
23and/or refs/tags) semi-visually.
Junio C Hamano1a4e8412005-12-27 08:17:2324
25It cannot show more than 29 branches and commits at a time.
26
Junio C Hamano38064d52006-01-15 10:13:4927It uses `showbranch.default` multi-valued configuration items if
28no <rev> nor <glob> is given on the command line.
29
Junio C Hamano1a4e8412005-12-27 08:17:2330
31OPTIONS
32-------
33<rev>::
Junio C Hamanoe3f080d2013-04-22 02:27:1334Arbitrary extended SHA-1 expression (see linkgit:gitrevisions[7])
Junio C Hamano54bf1e22008-12-20 06:30:1135that typically names a branch head or a tag.
Junio C Hamano1a4e8412005-12-27 08:17:2336
37<glob>::
38A glob pattern that matches branch or tag names under
Junio C Hamano4fdccb22010-02-19 09:58:1439refs/. For example, if you have many topic
40branches under refs/heads/topic, giving
Junio C Hamano1a4e8412005-12-27 08:17:2341`topic/*` would show all of them.
42
Junio C Hamanoeb415992008-06-08 22:49:4743-r::
44--remotes::
Junio C Hamano30e1db12006-12-23 10:29:5245Show the remote-tracking branches.
46
Junio C Hamanoeb415992008-06-08 22:49:4747-a::
48--all::
Junio C Hamano30e1db12006-12-23 10:29:5249Show both remote-tracking branches and local branches.
Junio C Hamano1a4e8412005-12-27 08:17:2350
Junio C Hamano38064d52006-01-15 10:13:4951--current::
52With this option, the command includes the current
53branch to the list of revs to be shown when it is not
54given on the command line.
55
Junio C Hamano1a4e8412005-12-27 08:17:2356--topo-order::
57 By default, the branches and their commits are shown in
58 reverse chronological order. This option makes them
59 appear in topological order (i.e., descendant commits
60 are shown before their parents).
61
Junio C Hamanocca56612009-06-03 08:27:3362--date-order::
63This option is similar to '--topo-order' in the sense that no
64parent comes before all of its children, but otherwise commits
65are ordered according to their commit date.
66
Junio C Hamano872c5682006-07-07 06:05:4067--sparse::
68By default, the output omits merges that are reachable
69from only one tip being shown. This option makes them
70visible.
71
Junio C Hamano1a4e8412005-12-27 08:17:2372--more=<n>::
73Usually the command stops output upon showing the commit
74that is the common ancestor of all the branches. This
75flag tells the command to go <n> more common commits
76beyond that. When <n> is negative, display only the
77<reference>s given, without showing the commit ancestry
78tree.
79
80--list::
Junio C Hamano38064d52006-01-15 10:13:4981Synonym to `--more=-1`
Junio C Hamano1a4e8412005-12-27 08:17:2382
83--merge-base::
Junio C Hamanofd9274d2009-08-05 21:21:3984Instead of showing the commit list, determine possible
85merge bases for the specified commits. All merge bases
86will be contained in all specified commits. This is
87different from how linkgit:git-merge-base[1] handles
88the case of three or more commits.
Junio C Hamano1a4e8412005-12-27 08:17:2389
90--independent::
91Among the <reference>s given, display only the ones that
92cannot be reached from any other <reference>.
93
94--no-name::
95Do not show naming strings for each commit.
96
97--sha1-name::
98Instead of naming the commits using the path to reach
99them from heads (e.g. "master~2" to mean the grandparent
100of "master"), name them with the unique prefix of their
101object names.
102
Junio C Hamano52401ef2006-12-19 00:54:38103--topics::
104Shows only commits that are NOT on the first branch given.
105This helps track topic branches by hiding any commit that
106is already in the main line of development. When given
107"git show-branch --topics master topic1 topic2", this
108will show the revisions given by "git rev-list {caret}master
109topic1 topic2"
110
Junio C Hamanoa3bb6eb2009-02-05 01:26:33111-g::
Junio C Hamano16cf1582007-02-05 07:21:48112--reflog[=<n>[,<base>]] [<ref>]::
Junio C Hamanodb450ba2007-01-21 08:57:14113Shows <n> most recent ref-log entries for the given
114ref. If <base> is given, <n> entries going back from
Junio C Hamanofa0d4cf2007-01-25 02:23:58115that entry. <base> can be specified as count or date.
Junio C Hamanoa3bb6eb2009-02-05 01:26:33116When no explicit <ref> parameter is given, it defaults to the
Junio C Hamano16cf1582007-02-05 07:21:48117current branch (or `HEAD` if it is detached).
Junio C Hamanod793de52006-12-26 09:11:43118
Junio C Hamano4aa0bcc2010-03-03 05:13:12119--color[=<when>]::
Junio C Hamano52ba2952009-05-18 17:43:02120Color the status sign (one of these: `*` `!` `+` `-`) of each commit
121corresponding to the branch it's in.
Junio C Hamano4aa0bcc2010-03-03 05:13:12122The value must be always (the default), never, or auto.
Junio C Hamano52ba2952009-05-18 17:43:02123
124--no-color::
125Turn off colored output, even when the configuration file gives the
126default to color output.
Junio C Hamano4aa0bcc2010-03-03 05:13:12127Same as `--color=never`.
Junio C Hamano52ba2952009-05-18 17:43:02128
Junio C Hamano1a4e8412005-12-27 08:17:23129Note that --more, --list, --independent and --merge-base options
130are mutually exclusive.
131
132
133OUTPUT
134------
135Given N <references>, the first N lines are the one-line
136description from their commit message. The branch head that is
Junio C Hamano38064d52006-01-15 10:13:49137pointed at by $GIT_DIR/HEAD is prefixed with an asterisk `*`
138character while other heads are prefixed with a `!` character.
Junio C Hamano1a4e8412005-12-27 08:17:23139
140Following these N lines, one-line log for each commit is
141displayed, indented N places. If a commit is on the I-th
Junio C Hamano38064d52006-01-15 10:13:49142branch, the I-th indentation character shows a `+` sign;
143otherwise it shows a space. Merge commits are denoted by
144a `-` sign. Each commit shows a short name that
Junio C Hamanoe3f080d2013-04-22 02:27:13145can be used as an extended SHA-1 to name that commit.
Junio C Hamano1a4e8412005-12-27 08:17:23146
147The following example shows three branches, "master", "fixes"
148and "mhf":
149
150------------------------------------------------
151$ git show-branch master fixes mhf
Junio C Hamano38064d52006-01-15 10:13:49152* [master] Add 'git show-branch'.
Junio C Hamano1a4e8412005-12-27 08:17:23153 ! [fixes] Introduce "reset type" flag to "git reset"
154 ! [mhf] Allow "+remote:local" refspec to cause --force when fetching.
155---
156 + [mhf] Allow "+remote:local" refspec to cause --force when fetching.
157 + [mhf~1] Use git-octopus when pulling more than one heads.
158 + [fixes] Introduce "reset type" flag to "git reset"
159 + [mhf~2] "git fetch --force".
160 + [mhf~3] Use .git/remote/origin, not .git/branches/origin.
161 + [mhf~4] Make "git pull" and "git fetch" default to origin
162 + [mhf~5] Infamous 'octopus merge'
163 + [mhf~6] Retire git-parse-remote.
164 + [mhf~7] Multi-head fetch.
165 + [mhf~8] Start adding the $GIT_DIR/remotes/ support.
Junio C Hamano38064d52006-01-15 10:13:49166*++ [master] Add 'git show-branch'.
Junio C Hamano1a4e8412005-12-27 08:17:23167------------------------------------------------
168
169These three branches all forked from a common commit, [master],
Junio C Hamano2db3e752010-09-03 21:33:06170whose commit message is "Add {apostrophe}git show-branch{apostrophe}".
171The "fixes" branch adds one commit "Introduce "reset type" flag to
172"git reset"". The "mhf" branch adds many other commits.
173The current branch is "master".
Junio C Hamano38064d52006-01-15 10:13:49174
175
176EXAMPLE
177-------
178
179If you keep your primary branches immediately under
Junio C Hamano4fdccb22010-02-19 09:58:14180`refs/heads`, and topic branches in subdirectories of
Junio C Hamano38064d52006-01-15 10:13:49181it, having the following in the configuration file may help:
182
183------------
184[showbranch]
185default = --topo-order
186default = heads/*
187
188------------
189
Junio C Hamano2b135272006-03-18 07:45:42190With this, `git show-branch` without extra parameters would show
Junio C Hamano38064d52006-01-15 10:13:49191only the primary branches. In addition, if you happen to be on
192your topic branch, it is shown as well.
193
Junio C Hamanodb450ba2007-01-21 08:57:14194------------
Junio C Hamanof62a11d2008-12-21 12:16:36195$ git show-branch --reflog="10,1 hour ago" --list master
Junio C Hamanodb450ba2007-01-21 08:57:14196------------
197
198shows 10 reflog entries going back from the tip as of 1 hour ago.
199Without `--list`, the output also shows how these tips are
200topologically related with each other.
Junio C Hamano1a4e8412005-12-27 08:17:23201
Junio C Hamano1a4e8412005-12-27 08:17:23202GIT
203---
Junio C Hamanof7c042d2008-06-06 22:50:53204Part of the linkgit:git[1] suite