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