]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-show-branch.txt
The seventh batch
[thirdparty/git.git] / Documentation / git-show-branch.txt
CommitLineData
f5e375c9
JH
1git-show-branch(1)
2==================
f5e375c9
JH
3
4NAME
5----
7bd7f280 6git-show-branch - Show branches and their commits
f5e375c9
JH
7
8SYNOPSIS
9--------
1aa68d67 10[verse]
e2f4e7e8 11'git show-branch' [-a | --all] [-r | --remotes] [--topo-order | --date-order]
73e9da01 12 [--current] [--color[=<when>] | --no-color] [--sparse]
bd494fc7 13 [--more=<n> | --list | --independent | --merge-base]
b3f298ab 14 [--no-name | --sha1-name] [--topics]
0adda936 15 [(<rev> | <glob>)...]
e2f4e7e8 16'git show-branch' (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]
f5e375c9
JH
17
18DESCRIPTION
19-----------
287f8600
JH
20
21Shows the commit ancestry graph starting from the commits named
c5d844af 22with <rev>s or <glob>s (or all refs under refs/heads
cc1b8d8b 23and/or refs/tags) semi-visually.
287f8600
JH
24
25It cannot show more than 29 branches and commits at a time.
26
54f9734e 27It uses `showbranch.default` multi-valued configuration items if
a58088ab 28no <rev> or <glob> is given on the command line.
54f9734e 29
f5e375c9
JH
30
31OPTIONS
32-------
287f8600 33<rev>::
d5fa1f1a 34 Arbitrary extended SHA-1 expression (see linkgit:gitrevisions[7])
04c8ce9c 35 that typically names a branch head or a tag.
287f8600
JH
36
37<glob>::
38 A glob pattern that matches branch or tag names under
cc1b8d8b
JK
39 refs/. For example, if you have many topic
40 branches under refs/heads/topic, giving
287f8600 41 `topic/*` would show all of them.
f5e375c9 42
3240240f
SB
43-r::
44--remotes::
f49006b0
BG
45 Show the remote-tracking branches.
46
3240240f
SB
47-a::
48--all::
f49006b0 49 Show both remote-tracking branches and local branches.
f5e375c9 50
1aa68d67
JH
51--current::
52 With this option, the command includes the current
9a9fd289 53 branch in the list of revs to be shown when it is not
1aa68d67
JH
54 given on the command line.
55
d4ce5f7e
NW
56--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
b3f298ab 62--date-order::
bcf9626a 63 This option is similar to `--topo-order` in the sense that no
b3f298ab
SB
64 parent comes before all of its children, but otherwise commits
65 are ordered according to their commit date.
66
8048e24b
JH
67--sparse::
68 By default, the output omits merges that are reachable
69 from only one tip being shown. This option makes them
70 visible.
71
f5e375c9
JH
72--more=<n>::
73 Usually the command stops output upon showing the commit
74 that is the common ancestor of all the branches. This
f85a4191 75 flag tells the command to go <n> more common commits
1f8af483 76 beyond that. When <n> is negative, display only the
0f45b5bc 77 <ref>s given, without showing the commit ancestry tree.
1f8af483
JH
78
79--list::
54f9734e 80 Synonym to `--more=-1`
f5e375c9
JH
81
82--merge-base::
f621a845
MG
83 Instead of showing the commit list, determine possible
84 merge bases for the specified commits. All merge bases
85 will be contained in all specified commits. This is
86 different from how linkgit:git-merge-base[1] handles
87 the case of three or more commits.
f5e375c9 88
1f8af483 89--independent::
0f45b5bc
JH
90 Among the <ref>s given, display only the ones that cannot be
91 reached from any other <ref>.
1f8af483 92
013f276e
JH
93--no-name::
94 Do not show naming strings for each commit.
95
96--sha1-name::
97 Instead of naming the commits using the path to reach
98 them from heads (e.g. "master~2" to mean the grandparent
99 of "master"), name them with the unique prefix of their
100 object names.
101
38c594d3
BG
102--topics::
103 Shows only commits that are NOT on the first branch given.
104 This helps track topic branches by hiding any commit that
105 is already in the main line of development. When given
106 "git show-branch --topics master topic1 topic2", this
107 will show the revisions given by "git rev-list {caret}master
108 topic1 topic2"
109
5c7eee03 110-g::
632ac9fd 111--reflog[=<n>[,<base>]] [<ref>]::
76a44c5c
JH
112 Shows <n> most recent ref-log entries for the given
113 ref. If <base> is given, <n> entries going back from
084ae0a7 114 that entry. <base> can be specified as count or date.
5c7eee03 115 When no explicit <ref> parameter is given, it defaults to the
632ac9fd 116 current branch (or `HEAD` if it is detached).
abc8ab19 117
73e9da01 118--color[=<when>]::
ab07ba2a
MH
119 Color the status sign (one of these: `*` `!` `+` `-`) of each commit
120 corresponding to the branch it's in.
73e9da01 121 The value must be always (the default), never, or auto.
ab07ba2a
MH
122
123--no-color::
124 Turn off colored output, even when the configuration file gives the
125 default to color output.
73e9da01 126 Same as `--color=never`.
ab07ba2a 127
4d542687 128Note that --more, --list, --independent, and --merge-base options
1f8af483
JH
129are mutually exclusive.
130
f5e375c9
JH
131
132OUTPUT
133------
0f45b5bc
JH
134
135Given N <ref>s, the first N lines are the one-line description from
136their commit message. The branch head that is pointed at by
137$GIT_DIR/HEAD is prefixed with an asterisk `*` character while other
138heads are prefixed with a `!` character.
f5e375c9 139
0a4f051f 140Following these N lines, a one-line log for each commit is
f5e375c9 141displayed, indented N places. If a commit is on the I-th
ebedc319
JH
142branch, 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
d5fa1f1a 145can be used as an extended SHA-1 to name that commit.
f5e375c9 146
4d542687 147The following example shows three branches, "master", "fixes",
f5e375c9
JH
148and "mhf":
149
150------------------------------------------------
151$ git show-branch master fixes mhf
ebedc319 152* [master] Add 'git show-branch'.
f5e375c9
JH
153 ! [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.
6cc668c0 157 + [mhf~1] Use git-octopus when pulling more than one head.
f5e375c9
JH
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.
ebedc319 166*++ [master] Add 'git show-branch'.
f5e375c9
JH
167------------------------------------------------
168
169These three branches all forked from a common commit, [master],
f64a21bd 170whose commit message is "Add \'git show-branch'".
a5218458
JN
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".
f5e375c9 174
f5e375c9 175
76a8788c
NTND
176EXAMPLES
177--------
54f9734e
JH
178
179If you keep your primary branches immediately under
cc1b8d8b 180`refs/heads`, and topic branches in subdirectories of
54f9734e
JH
181it, having the following in the configuration file may help:
182
183------------
184[showbranch]
185 default = --topo-order
186 default = heads/*
187
188------------
189
beb8e134 190With this, `git show-branch` without extra parameters would show
1aa68d67
JH
191only the primary branches. In addition, if you happen to be on
192your topic branch, it is shown as well.
54f9734e 193
76a44c5c 194------------
b3eae84d 195$ git show-branch --reflog="10,1 hour ago" --list master
76a44c5c
JH
196------------
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
9a9fd289 200topologically related to each other.
54f9734e 201
16f6b0d1
ÆAB
202CONFIGURATION
203-------------
204
205include::includes/cmd-config-section-all.txt[]
206
207include::config/showbranch.txt[]
208
f5e375c9
JH
209GIT
210---
9e1f0a85 211Part of the linkgit:git[1] suite