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