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