]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-show-branch.txt
Docs: Use "-l::\n--long\n" format in OPTIONS sections
[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]
f49006b0 11'git-show-branch' [--all] [--remotes] [--topo-order] [--current]
bd494fc7 12 [--more=<n> | --list | --independent | --merge-base]
38c594d3 13 [--no-name | --sha1-name] [--topics] [<rev> | <glob>]...
632ac9fd 14'git-show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]
f5e375c9
JH
15
16DESCRIPTION
17-----------
287f8600
JH
18
19Shows the commit ancestry graph starting from the commits named
20with <rev>s or <globs>s (or all refs under $GIT_DIR/refs/heads
21and/or $GIT_DIR/refs/tags) semi-visually.
22
23It cannot show more than 29 branches and commits at a time.
24
54f9734e
JH
25It uses `showbranch.default` multi-valued configuration items if
26no <rev> nor <glob> is given on the command line.
27
f5e375c9
JH
28
29OPTIONS
30-------
287f8600
JH
31<rev>::
32 Arbitrary extended SHA1 expression (see `git-rev-parse`)
33 that typically names a branch HEAD or a tag.
34
35<glob>::
36 A glob pattern that matches branch or tag names under
37 $GIT_DIR/refs. For example, if you have many topic
38 branches under $GIT_DIR/refs/heads/topic, giving
39 `topic/*` would show all of them.
f5e375c9 40
3240240f
SB
41-r::
42--remotes::
f49006b0
BG
43 Show the remote-tracking branches.
44
3240240f
SB
45-a::
46--all::
f49006b0 47 Show both remote-tracking branches and local branches.
f5e375c9 48
1aa68d67
JH
49--current::
50 With this option, the command includes the current
51 branch to the list of revs to be shown when it is not
52 given on the command line.
53
d4ce5f7e
NW
54--topo-order::
55 By default, the branches and their commits are shown in
56 reverse chronological order. This option makes them
57 appear in topological order (i.e., descendant commits
58 are shown before their parents).
59
8048e24b
JH
60--sparse::
61 By default, the output omits merges that are reachable
62 from only one tip being shown. This option makes them
63 visible.
64
f5e375c9
JH
65--more=<n>::
66 Usually the command stops output upon showing the commit
67 that is the common ancestor of all the branches. This
f85a4191 68 flag tells the command to go <n> more common commits
1f8af483
JH
69 beyond that. When <n> is negative, display only the
70 <reference>s given, without showing the commit ancestry
71 tree.
72
73--list::
54f9734e 74 Synonym to `--more=-1`
f5e375c9
JH
75
76--merge-base::
77 Instead of showing the commit list, just act like the
2f0f8b71
JH
78 'git-merge-base -a' command, except that it can accept
79 more than two heads.
f5e375c9 80
1f8af483
JH
81--independent::
82 Among the <reference>s given, display only the ones that
83 cannot be reached from any other <reference>.
84
013f276e
JH
85--no-name::
86 Do not show naming strings for each commit.
87
88--sha1-name::
89 Instead of naming the commits using the path to reach
90 them from heads (e.g. "master~2" to mean the grandparent
91 of "master"), name them with the unique prefix of their
92 object names.
93
38c594d3
BG
94--topics::
95 Shows only commits that are NOT on the first branch given.
96 This helps track topic branches by hiding any commit that
97 is already in the main line of development. When given
98 "git show-branch --topics master topic1 topic2", this
99 will show the revisions given by "git rev-list {caret}master
100 topic1 topic2"
101
632ac9fd 102--reflog[=<n>[,<base>]] [<ref>]::
76a44c5c
JH
103 Shows <n> most recent ref-log entries for the given
104 ref. If <base> is given, <n> entries going back from
084ae0a7 105 that entry. <base> can be specified as count or date.
632ac9fd
JH
106 `-g` can be used as a short-hand for this option. When
107 no explicit <ref> parameter is given, it defaults to the
108 current branch (or `HEAD` if it is detached).
abc8ab19 109
1f8af483
JH
110Note that --more, --list, --independent and --merge-base options
111are mutually exclusive.
112
f5e375c9
JH
113
114OUTPUT
115------
116Given N <references>, the first N lines are the one-line
117description from their commit message. The branch head that is
ebedc319
JH
118pointed at by $GIT_DIR/HEAD is prefixed with an asterisk `*`
119character while other heads are prefixed with a `!` character.
f5e375c9
JH
120
121Following these N lines, one-line log for each commit is
122displayed, indented N places. If a commit is on the I-th
ebedc319
JH
123branch, the I-th indentation character shows a `+` sign;
124otherwise it shows a space. Merge commits are denoted by
125a `-` sign. Each commit shows a short name that
89438677 126can be used as an extended SHA1 to name that commit.
f5e375c9
JH
127
128The following example shows three branches, "master", "fixes"
129and "mhf":
130
131------------------------------------------------
132$ git show-branch master fixes mhf
ebedc319 133* [master] Add 'git show-branch'.
f5e375c9
JH
134 ! [fixes] Introduce "reset type" flag to "git reset"
135 ! [mhf] Allow "+remote:local" refspec to cause --force when fetching.
136---
137 + [mhf] Allow "+remote:local" refspec to cause --force when fetching.
138 + [mhf~1] Use git-octopus when pulling more than one heads.
139 + [fixes] Introduce "reset type" flag to "git reset"
140 + [mhf~2] "git fetch --force".
141 + [mhf~3] Use .git/remote/origin, not .git/branches/origin.
142 + [mhf~4] Make "git pull" and "git fetch" default to origin
143 + [mhf~5] Infamous 'octopus merge'
144 + [mhf~6] Retire git-parse-remote.
145 + [mhf~7] Multi-head fetch.
146 + [mhf~8] Start adding the $GIT_DIR/remotes/ support.
ebedc319 147*++ [master] Add 'git show-branch'.
f5e375c9
JH
148------------------------------------------------
149
150These three branches all forked from a common commit, [master],
151whose commit message is "Add 'git show-branch'. "fixes" branch
152adds one commit 'Introduce "reset type"'. "mhf" branch has many
ebedc319 153other commits. The current branch is "master".
f5e375c9 154
f5e375c9 155
54f9734e
JH
156EXAMPLE
157-------
158
159If you keep your primary branches immediately under
160`$GIT_DIR/refs/heads`, and topic branches in subdirectories of
161it, having the following in the configuration file may help:
162
163------------
164[showbranch]
165 default = --topo-order
166 default = heads/*
167
168------------
169
beb8e134 170With this, `git show-branch` without extra parameters would show
1aa68d67
JH
171only the primary branches. In addition, if you happen to be on
172your topic branch, it is shown as well.
54f9734e 173
76a44c5c
JH
174------------
175$ git show-branch --reflog='10,1 hour ago' --list master
176------------
177
178shows 10 reflog entries going back from the tip as of 1 hour ago.
179Without `--list`, the output also shows how these tips are
180topologically related with each other.
54f9734e
JH
181
182
f5e375c9
JH
183Author
184------
185Written by Junio C Hamano <junkio@cox.net>
186
187
188Documentation
189--------------
190Documentation by Junio C Hamano.
191
192
193GIT
194---
9e1f0a85 195Part of the linkgit:git[1] suite