Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 1 | git-show-branch(1) |
| 2 | ================== |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 3 | |
| 4 | NAME |
| 5 | ---- |
Fredrik Kuivinen | 7bd7f28 | 2006-03-09 17:24:50 +0100 | [diff] [blame] | 6 | git-show-branch - Show branches and their commits |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
Junio C Hamano | 1aa68d6 | 2006-01-11 00:16:42 -0800 | [diff] [blame] | 10 | [verse] |
Michael J Gruber | 995bdc7 | 2009-08-05 09:59:19 +0200 | [diff] [blame] | 11 | 'git show-branch' [-a|--all] [-r|--remotes] [--topo-order | --date-order] |
Mark Lodato | 73e9da0 | 2010-02-16 23:55:58 -0500 | [diff] [blame] | 12 | [--current] [--color[=<when>] | --no-color] [--sparse] |
Dmitry V. Levin | bd494fc | 2006-03-06 03:00:48 +0300 | [diff] [blame] | 13 | [--more=<n> | --list | --independent | --merge-base] |
Stephen Boyd | b3f298a | 2009-05-31 23:34:46 -0700 | [diff] [blame] | 14 | [--no-name | --sha1-name] [--topics] |
Štěpán Němec | 0adda93 | 2010-10-08 19:31:17 +0200 | [diff] [blame] | 15 | [(<rev> | <glob>)...] |
Michael J Gruber | 995bdc7 | 2009-08-05 09:59:19 +0200 | [diff] [blame] | 16 | |
Jonathan Nieder | b1889c3 | 2008-06-30 01:09:04 -0500 | [diff] [blame] | 17 | 'git show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>] |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 18 | |
| 19 | DESCRIPTION |
| 20 | ----------- |
Junio C Hamano | 287f860 | 2005-12-04 15:58:50 -0800 | [diff] [blame] | 21 | |
| 22 | Shows the commit ancestry graph starting from the commits named |
Jeff King | cc1b8d8 | 2010-02-17 20:16:20 -0500 | [diff] [blame] | 23 | with <rev>s or <globs>s (or all refs under refs/heads |
| 24 | and/or refs/tags) semi-visually. |
Junio C Hamano | 287f860 | 2005-12-04 15:58:50 -0800 | [diff] [blame] | 25 | |
| 26 | It cannot show more than 29 branches and commits at a time. |
| 27 | |
Junio C Hamano | 54f9734 | 2006-01-11 00:09:16 -0800 | [diff] [blame] | 28 | It uses `showbranch.default` multi-valued configuration items if |
| 29 | no <rev> nor <glob> is given on the command line. |
| 30 | |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 31 | |
| 32 | OPTIONS |
| 33 | ------- |
Junio C Hamano | 287f860 | 2005-12-04 15:58:50 -0800 | [diff] [blame] | 34 | <rev>:: |
Jonathan Nieder | 9d83e38 | 2010-10-11 11:03:32 -0500 | [diff] [blame] | 35 | Arbitrary extended SHA1 expression (see linkgit:gitrevisions[7]) |
Markus Heidelberg | 04c8ce9 | 2008-12-19 13:14:18 +0100 | [diff] [blame] | 36 | that typically names a branch head or a tag. |
Junio C Hamano | 287f860 | 2005-12-04 15:58:50 -0800 | [diff] [blame] | 37 | |
| 38 | <glob>:: |
| 39 | A glob pattern that matches branch or tag names under |
Jeff King | cc1b8d8 | 2010-02-17 20:16:20 -0500 | [diff] [blame] | 40 | refs/. For example, if you have many topic |
| 41 | branches under refs/heads/topic, giving |
Junio C Hamano | 287f860 | 2005-12-04 15:58:50 -0800 | [diff] [blame] | 42 | `topic/*` would show all of them. |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 43 | |
Stephan Beyer | 3240240 | 2008-06-08 03:36:09 +0200 | [diff] [blame] | 44 | -r:: |
| 45 | --remotes:: |
Brian Gernhardt | f49006b | 2006-12-22 08:58:39 -0500 | [diff] [blame] | 46 | Show the remote-tracking branches. |
| 47 | |
Stephan Beyer | 3240240 | 2008-06-08 03:36:09 +0200 | [diff] [blame] | 48 | -a:: |
| 49 | --all:: |
Brian Gernhardt | f49006b | 2006-12-22 08:58:39 -0500 | [diff] [blame] | 50 | Show both remote-tracking branches and local branches. |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 51 | |
Junio C Hamano | 1aa68d6 | 2006-01-11 00:16:42 -0800 | [diff] [blame] | 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. |
| 56 | |
Nikolai Weibull | d4ce5f7 | 2005-12-09 00:28:05 +0100 | [diff] [blame] | 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). |
| 62 | |
Stephen Boyd | b3f298a | 2009-05-31 23:34:46 -0700 | [diff] [blame] | 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. |
| 67 | |
Junio C Hamano | 8048e24 | 2006-07-06 19:21:47 -0700 | [diff] [blame] | 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. |
| 72 | |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 73 | --more=<n>:: |
| 74 | Usually the command stops output upon showing the commit |
| 75 | that is the common ancestor of all the branches. This |
Junio C Hamano | f85a419 | 2005-08-29 17:21:06 -0700 | [diff] [blame] | 76 | flag tells the command to go <n> more common commits |
Junio C Hamano | 1f8af48 | 2005-09-09 15:40:45 -0700 | [diff] [blame] | 77 | beyond that. When <n> is negative, display only the |
| 78 | <reference>s given, without showing the commit ancestry |
| 79 | tree. |
| 80 | |
| 81 | --list:: |
Junio C Hamano | 54f9734 | 2006-01-11 00:09:16 -0800 | [diff] [blame] | 82 | Synonym to `--more=-1` |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 83 | |
| 84 | --merge-base:: |
Michael J Gruber | f621a84 | 2009-08-05 09:59:20 +0200 | [diff] [blame] | 85 | Instead of showing the commit list, determine possible |
| 86 | merge bases for the specified commits. All merge bases |
| 87 | will be contained in all specified commits. This is |
| 88 | different from how linkgit:git-merge-base[1] handles |
| 89 | the case of three or more commits. |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 90 | |
Junio C Hamano | 1f8af48 | 2005-09-09 15:40:45 -0700 | [diff] [blame] | 91 | --independent:: |
| 92 | Among the <reference>s given, display only the ones that |
| 93 | cannot be reached from any other <reference>. |
| 94 | |
Junio C Hamano | 013f276 | 2005-10-11 15:22:48 -0700 | [diff] [blame] | 95 | --no-name:: |
| 96 | Do not show naming strings for each commit. |
| 97 | |
| 98 | --sha1-name:: |
| 99 | Instead of naming the commits using the path to reach |
| 100 | them from heads (e.g. "master~2" to mean the grandparent |
| 101 | of "master"), name them with the unique prefix of their |
| 102 | object names. |
| 103 | |
Brian Gernhardt | 38c594d | 2006-12-18 10:48:33 -0500 | [diff] [blame] | 104 | --topics:: |
| 105 | Shows only commits that are NOT on the first branch given. |
| 106 | This helps track topic branches by hiding any commit that |
| 107 | is already in the main line of development. When given |
| 108 | "git show-branch --topics master topic1 topic2", this |
| 109 | will show the revisions given by "git rev-list {caret}master |
| 110 | topic1 topic2" |
| 111 | |
jidanni@jidanni.org | 5c7eee0 | 2009-01-06 11:14:02 +0800 | [diff] [blame] | 112 | -g:: |
Junio C Hamano | 632ac9f | 2007-02-03 23:31:47 -0800 | [diff] [blame] | 113 | --reflog[=<n>[,<base>]] [<ref>]:: |
Junio C Hamano | 76a44c5 | 2007-01-19 01:20:23 -0800 | [diff] [blame] | 114 | Shows <n> most recent ref-log entries for the given |
| 115 | ref. If <base> is given, <n> entries going back from |
Johannes Schindelin | 084ae0a | 2007-01-24 15:05:16 +0100 | [diff] [blame] | 116 | that entry. <base> can be specified as count or date. |
jidanni@jidanni.org | 5c7eee0 | 2009-01-06 11:14:02 +0800 | [diff] [blame] | 117 | When no explicit <ref> parameter is given, it defaults to the |
Junio C Hamano | 632ac9f | 2007-02-03 23:31:47 -0800 | [diff] [blame] | 118 | current branch (or `HEAD` if it is detached). |
Junio C Hamano | abc8ab1 | 2006-12-26 00:11:50 -0800 | [diff] [blame] | 119 | |
Mark Lodato | 73e9da0 | 2010-02-16 23:55:58 -0500 | [diff] [blame] | 120 | --color[=<when>]:: |
Markus Heidelberg | ab07ba2 | 2009-04-22 23:41:25 +0200 | [diff] [blame] | 121 | Color the status sign (one of these: `*` `!` `+` `-`) of each commit |
| 122 | corresponding to the branch it's in. |
Mark Lodato | 73e9da0 | 2010-02-16 23:55:58 -0500 | [diff] [blame] | 123 | The value must be always (the default), never, or auto. |
Markus Heidelberg | ab07ba2 | 2009-04-22 23:41:25 +0200 | [diff] [blame] | 124 | |
| 125 | --no-color:: |
| 126 | Turn off colored output, even when the configuration file gives the |
| 127 | default to color output. |
Mark Lodato | 73e9da0 | 2010-02-16 23:55:58 -0500 | [diff] [blame] | 128 | Same as `--color=never`. |
Markus Heidelberg | ab07ba2 | 2009-04-22 23:41:25 +0200 | [diff] [blame] | 129 | |
Junio C Hamano | 1f8af48 | 2005-09-09 15:40:45 -0700 | [diff] [blame] | 130 | Note that --more, --list, --independent and --merge-base options |
| 131 | are mutually exclusive. |
| 132 | |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 133 | |
| 134 | OUTPUT |
| 135 | ------ |
| 136 | Given N <references>, the first N lines are the one-line |
| 137 | description from their commit message. The branch head that is |
Junio C Hamano | ebedc31 | 2006-01-11 14:02:38 -0800 | [diff] [blame] | 138 | pointed at by $GIT_DIR/HEAD is prefixed with an asterisk `*` |
| 139 | character while other heads are prefixed with a `!` character. |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 140 | |
| 141 | Following these N lines, one-line log for each commit is |
| 142 | displayed, indented N places. If a commit is on the I-th |
Junio C Hamano | ebedc31 | 2006-01-11 14:02:38 -0800 | [diff] [blame] | 143 | branch, the I-th indentation character shows a `+` sign; |
| 144 | otherwise it shows a space. Merge commits are denoted by |
| 145 | a `-` sign. Each commit shows a short name that |
Junio C Hamano | 8943867 | 2005-12-29 01:20:06 -0800 | [diff] [blame] | 146 | can be used as an extended SHA1 to name that commit. |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 147 | |
| 148 | The following example shows three branches, "master", "fixes" |
| 149 | and "mhf": |
| 150 | |
| 151 | ------------------------------------------------ |
| 152 | $ git show-branch master fixes mhf |
Junio C Hamano | ebedc31 | 2006-01-11 14:02:38 -0800 | [diff] [blame] | 153 | * [master] Add 'git show-branch'. |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 154 | ! [fixes] Introduce "reset type" flag to "git reset" |
| 155 | ! [mhf] Allow "+remote:local" refspec to cause --force when fetching. |
| 156 | --- |
| 157 | + [mhf] Allow "+remote:local" refspec to cause --force when fetching. |
| 158 | + [mhf~1] Use git-octopus when pulling more than one heads. |
| 159 | + [fixes] Introduce "reset type" flag to "git reset" |
| 160 | + [mhf~2] "git fetch --force". |
| 161 | + [mhf~3] Use .git/remote/origin, not .git/branches/origin. |
| 162 | + [mhf~4] Make "git pull" and "git fetch" default to origin |
| 163 | + [mhf~5] Infamous 'octopus merge' |
| 164 | + [mhf~6] Retire git-parse-remote. |
| 165 | + [mhf~7] Multi-head fetch. |
| 166 | + [mhf~8] Start adding the $GIT_DIR/remotes/ support. |
Junio C Hamano | ebedc31 | 2006-01-11 14:02:38 -0800 | [diff] [blame] | 167 | *++ [master] Add 'git show-branch'. |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 168 | ------------------------------------------------ |
| 169 | |
| 170 | These three branches all forked from a common commit, [master], |
Jonathan Nieder | a521845 | 2010-08-20 05:37:06 -0500 | [diff] [blame] | 171 | whose commit message is "Add {apostrophe}git show-branch{apostrophe}". |
| 172 | The "fixes" branch adds one commit "Introduce "reset type" flag to |
| 173 | "git reset"". The "mhf" branch adds many other commits. |
| 174 | The current branch is "master". |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 175 | |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 176 | |
Junio C Hamano | 54f9734 | 2006-01-11 00:09:16 -0800 | [diff] [blame] | 177 | EXAMPLE |
| 178 | ------- |
| 179 | |
| 180 | If you keep your primary branches immediately under |
Jeff King | cc1b8d8 | 2010-02-17 20:16:20 -0500 | [diff] [blame] | 181 | `refs/heads`, and topic branches in subdirectories of |
Junio C Hamano | 54f9734 | 2006-01-11 00:09:16 -0800 | [diff] [blame] | 182 | it, having the following in the configuration file may help: |
| 183 | |
| 184 | ------------ |
| 185 | [showbranch] |
| 186 | default = --topo-order |
| 187 | default = heads/* |
| 188 | |
| 189 | ------------ |
| 190 | |
Jon Loeliger | beb8e13 | 2006-03-17 18:25:46 -0600 | [diff] [blame] | 191 | With this, `git show-branch` without extra parameters would show |
Junio C Hamano | 1aa68d6 | 2006-01-11 00:16:42 -0800 | [diff] [blame] | 192 | only the primary branches. In addition, if you happen to be on |
| 193 | your topic branch, it is shown as well. |
Junio C Hamano | 54f9734 | 2006-01-11 00:09:16 -0800 | [diff] [blame] | 194 | |
Junio C Hamano | 76a44c5 | 2007-01-19 01:20:23 -0800 | [diff] [blame] | 195 | ------------ |
Markus Heidelberg | b3eae84 | 2008-12-21 02:00:31 -0800 | [diff] [blame] | 196 | $ git show-branch --reflog="10,1 hour ago" --list master |
Junio C Hamano | 76a44c5 | 2007-01-19 01:20:23 -0800 | [diff] [blame] | 197 | ------------ |
| 198 | |
| 199 | shows 10 reflog entries going back from the tip as of 1 hour ago. |
| 200 | Without `--list`, the output also shows how these tips are |
| 201 | topologically related with each other. |
Junio C Hamano | 54f9734 | 2006-01-11 00:09:16 -0800 | [diff] [blame] | 202 | |
Junio C Hamano | f5e375c | 2005-08-22 23:16:46 -0700 | [diff] [blame] | 203 | GIT |
| 204 | --- |
Christian Couder | 9e1f0a8 | 2008-06-06 09:07:32 +0200 | [diff] [blame] | 205 | Part of the linkgit:git[1] suite |