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