1GIT-SHOW-BRANCH(1) Git Manual GIT-SHOW-BRANCH(1)
2
3
4
6 git-show-branch - Show branches and their commits
7
9 git show-branch [-a|--all] [-r|--remotes] [--topo-order | --date-order]
10 [--current] [--color[=<when>] | --no-color] [--sparse]
11 [--more=<n> | --list | --independent | --merge-base]
12 [--no-name | --sha1-name] [--topics]
13 [<rev> | <glob>]...
14
15
16 git show-branch (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]
17
19 Shows the commit ancestry graph starting from the commits named with
20 <rev>s or <globs>s (or all refs under refs/heads and/or refs/tags)
21 semi-visually.
22
23 It cannot show more than 29 branches and commits at a time.
24
25 It uses showbranch.default multi-valued configuration items if no <rev>
26 nor <glob> is given on the command line.
27
29 <rev>
30 Arbitrary extended SHA1 expression (see git-rev-parse(1)) that
31 typically names a branch head or a tag.
32
33 <glob>
34 A glob pattern that matches branch or tag names under refs/. For
35 example, if you have many topic branches under refs/heads/topic,
36 giving topic/* would show all of them.
37
38 -r, --remotes
39 Show the remote-tracking branches.
40
41 -a, --all
42 Show both remote-tracking branches and local branches.
43
44 --current
45 With this option, the command includes the current branch to the
46 list of revs to be shown when it is not given on the command line.
47
48 --topo-order
49 By default, the branches and their commits are shown in reverse
50 chronological order. This option makes them appear in topological
51 order (i.e., descendant commits are shown before their parents).
52
53 --date-order
54 This option is similar to --topo-order in the sense that no parent
55 comes before all of its children, but otherwise commits are ordered
56 according to their commit date.
57
58 --sparse
59 By default, the output omits merges that are reachable from only
60 one tip being shown. This option makes them visible.
61
62 --more=<n>
63 Usually the command stops output upon showing the commit that is
64 the common ancestor of all the branches. This flag tells the
65 command to go <n> more common commits beyond that. When <n> is
66 negative, display only the <reference>s given, without showing the
67 commit ancestry tree.
68
69 --list
70 Synonym to --more=-1
71
72 --merge-base
73 Instead of showing the commit list, determine possible merge bases
74 for the specified commits. All merge bases will be contained in all
75 specified commits. This is different from how git-merge-base(1)
76 handles the case of three or more commits.
77
78 --independent
79 Among the <reference>s given, display only the ones that cannot be
80 reached from any other <reference>.
81
82 --no-name
83 Do not show naming strings for each commit.
84
85 --sha1-name
86 Instead of naming the commits using the path to reach them from
87 heads (e.g. "master~2" to mean the grandparent of "master"), name
88 them with the unique prefix of their object names.
89
90 --topics
91 Shows only commits that are NOT on the first branch given. This
92 helps track topic branches by hiding any commit that is already in
93 the main line of development. When given "git show-branch --topics
94 master topic1 topic2", this will show the revisions given by "git
95 rev-list ^master topic1 topic2"
96
97 -g, --reflog[=<n>[,<base>]] [<ref>]
98 Shows <n> most recent ref-log entries for the given ref. If <base>
99 is given, <n> entries going back from that entry. <base> can be
100 specified as count or date. When no explicit <ref> parameter is
101 given, it defaults to the current branch (or HEAD if it is
102 detached).
103
104 --color[=<when>]
105 Color the status sign (one of these: * ! + -) of each commit
106 corresponding to the branch it’s in. The value must be always (the
107 default), never, or auto.
108
109 --no-color
110 Turn off colored output, even when the configuration file gives the
111 default to color output. Same as --color=never.
112
113 Note that --more, --list, --independent and --merge-base options are
114 mutually exclusive.
115
117 Given N <references>, the first N lines are the one-line description
118 from their commit message. The branch head that is pointed at by
119 $GIT_DIR/HEAD is prefixed with an asterisk * character while other
120 heads are prefixed with a ! character.
121
122 Following these N lines, one-line log for each commit is displayed,
123 indented N places. If a commit is on the I-th branch, the I-th
124 indentation character shows a + sign; otherwise it shows a space. Merge
125 commits are denoted by a - sign. Each commit shows a short name that
126 can be used as an extended SHA1 to name that commit.
127
128 The following example shows three branches, "master", "fixes" and
129 "mhf":
130
131 $ git show-branch master fixes mhf
132 * [master] Add ´git show-branch´.
133 ! [fixes] Introduce "reset type" flag to "git reset"
134 ! [mhf] Allow "+remote:local" refspec to cause --force when fetching.
135 ---
136 + [mhf] Allow "+remote:local" refspec to cause --force when fetching.
137 + [mhf~1] Use git-octopus when pulling more than one heads.
138 + [fixes] Introduce "reset type" flag to "git reset"
139 + [mhf~2] "git fetch --force".
140 + [mhf~3] Use .git/remote/origin, not .git/branches/origin.
141 + [mhf~4] Make "git pull" and "git fetch" default to origin
142 + [mhf~5] Infamous ´octopus merge´
143 + [mhf~6] Retire git-parse-remote.
144 + [mhf~7] Multi-head fetch.
145 + [mhf~8] Start adding the $GIT_DIR/remotes/ support.
146 *++ [master] Add ´git show-branch´.
147
148
149 These three branches all forked from a common commit, [master], whose
150 commit message is "Add ´git show-branch\´". The "fixes" branch adds one
151 commit "Introduce "reset type" flag to "git reset"". The "mhf" branch
152 adds many other commits. The current branch is "master".
153
155 If you keep your primary branches immediately under refs/heads, and
156 topic branches in subdirectories of it, having the following in the
157 configuration file may help:
158
159 [showbranch]
160 default = --topo-order
161 default = heads/*
162
163
164 With this, git show-branch without extra parameters would show only the
165 primary branches. In addition, if you happen to be on your topic
166 branch, it is shown as well.
167
168 $ git show-branch --reflog="10,1 hour ago" --list master
169
170
171 shows 10 reflog entries going back from the tip as of 1 hour ago.
172 Without --list, the output also shows how these tips are topologically
173 related with each other.
174
176 Written by Junio C Hamano <gitster@pobox.com[1]>
177
179 Documentation by Junio C Hamano.
180
182 Part of the git(1) suite
183
185 1. gitster@pobox.com
186 mailto:gitster@pobox.com
187
188
189
190Git 1.7.1 08/16/2017 GIT-SHOW-BRANCH(1)