]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-show-branch.txt
Merge branch 'mz/rebase-abort-reflog-fix'
[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]
995bdc73 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>)...]
995bdc73 16
b1889c36 17'git show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]
f5e375c9
JH
18
19DESCRIPTION
20-----------
287f8600
JH
21
22Shows the commit ancestry graph starting from the commits named
cc1b8d8b
JK
23with <rev>s or <globs>s (or all refs under refs/heads
24and/or refs/tags) semi-visually.
287f8600
JH
25
26It cannot show more than 29 branches and commits at a time.
27
54f9734e
JH
28It uses `showbranch.default` multi-valued configuration items if
29no <rev> nor <glob> is given on the command line.
30
f5e375c9
JH
31
32OPTIONS
33-------
287f8600 34<rev>::
9d83e382 35 Arbitrary extended SHA1 expression (see linkgit:gitrevisions[7])
04c8ce9c 36 that typically names a branch head or a tag.
287f8600
JH
37
38<glob>::
39 A glob pattern that matches branch or tag names under
cc1b8d8b
JK
40 refs/. For example, if you have many topic
41 branches under refs/heads/topic, giving
287f8600 42 `topic/*` would show all of them.
f5e375c9 43
3240240f
SB
44-r::
45--remotes::
f49006b0
BG
46 Show the remote-tracking branches.
47
3240240f
SB
48-a::
49--all::
f49006b0 50 Show both remote-tracking branches and local branches.
f5e375c9 51
1aa68d67
JH
52--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
d4ce5f7e
NW
57--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
b3f298ab
SB
63--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
8048e24b
JH
68--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
f5e375c9
JH
73--more=<n>::
74 Usually the command stops output upon showing the commit
75 that is the common ancestor of all the branches. This
f85a4191 76 flag tells the command to go <n> more common commits
1f8af483
JH
77 beyond that. When <n> is negative, display only the
78 <reference>s given, without showing the commit ancestry
79 tree.
80
81--list::
54f9734e 82 Synonym to `--more=-1`
f5e375c9
JH
83
84--merge-base::
f621a845
MG
85 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.
f5e375c9 90
1f8af483
JH
91--independent::
92 Among the <reference>s given, display only the ones that
93 cannot be reached from any other <reference>.
94
013f276e
JH
95--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
38c594d3
BG
104--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
5c7eee03 112-g::
632ac9fd 113--reflog[=<n>[,<base>]] [<ref>]::
76a44c5c
JH
114 Shows <n> most recent ref-log entries for the given
115 ref. If <base> is given, <n> entries going back from
084ae0a7 116 that entry. <base> can be specified as count or date.
5c7eee03 117 When no explicit <ref> parameter is given, it defaults to the
632ac9fd 118 current branch (or `HEAD` if it is detached).
abc8ab19 119
73e9da01 120--color[=<when>]::
ab07ba2a
MH
121 Color the status sign (one of these: `*` `!` `+` `-`) of each commit
122 corresponding to the branch it's in.
73e9da01 123 The value must be always (the default), never, or auto.
ab07ba2a
MH
124
125--no-color::
126 Turn off colored output, even when the configuration file gives the
127 default to color output.
73e9da01 128 Same as `--color=never`.
ab07ba2a 129
1f8af483
JH
130Note that --more, --list, --independent and --merge-base options
131are mutually exclusive.
132
f5e375c9
JH
133
134OUTPUT
135------
136Given N <references>, the first N lines are the one-line
137description from their commit message. The branch head that is
ebedc319
JH
138pointed at by $GIT_DIR/HEAD is prefixed with an asterisk `*`
139character while other heads are prefixed with a `!` character.
f5e375c9
JH
140
141Following these N lines, one-line log for each commit is
142displayed, indented N places. If a commit is on the I-th
ebedc319
JH
143branch, 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
89438677 146can be used as an extended SHA1 to name that commit.
f5e375c9
JH
147
148The following example shows three branches, "master", "fixes"
149and "mhf":
150
151------------------------------------------------
152$ git show-branch master fixes mhf
ebedc319 153* [master] Add 'git show-branch'.
f5e375c9
JH
154 ! [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.
ebedc319 167*++ [master] Add 'git show-branch'.
f5e375c9
JH
168------------------------------------------------
169
170These three branches all forked from a common commit, [master],
a5218458
JN
171whose 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".
f5e375c9 175
f5e375c9 176
54f9734e
JH
177EXAMPLE
178-------
179
180If you keep your primary branches immediately under
cc1b8d8b 181`refs/heads`, and topic branches in subdirectories of
54f9734e
JH
182it, having the following in the configuration file may help:
183
184------------
185[showbranch]
186 default = --topo-order
187 default = heads/*
188
189------------
190
beb8e134 191With this, `git show-branch` without extra parameters would show
1aa68d67
JH
192only the primary branches. In addition, if you happen to be on
193your topic branch, it is shown as well.
54f9734e 194
76a44c5c 195------------
b3eae84d 196$ git show-branch --reflog="10,1 hour ago" --list master
76a44c5c
JH
197------------
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.
54f9734e
JH
202
203
f5e375c9
JH
204Author
205------
59eb68aa 206Written by Junio C Hamano <gitster@pobox.com>
f5e375c9
JH
207
208
209Documentation
210--------------
211Documentation by Junio C Hamano.
212
213
214GIT
215---
9e1f0a85 216Part of the linkgit:git[1] suite