Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-show-branch(1) |
| 2 | ================== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 6 | git-show-branch - Show branches and their commits |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 10 | [verse] |
Junio C Hamano | fd9274d | 2009-08-05 21:21:39 | [diff] [blame] | 11 | 'git show-branch' [-a|--all] [-r|--remotes] [--topo-order | --date-order] |
| 12 | [--current] [--color | --no-color] [--sparse] |
Junio C Hamano | 2bb1310 | 2006-03-06 07:10:21 | [diff] [blame] | 13 | [--more=<n> | --list | --independent | --merge-base] |
Junio C Hamano | cca5661 | 2009-06-03 08:27:33 | [diff] [blame] | 14 | [--no-name | --sha1-name] [--topics] |
| 15 | [<rev> | <glob>]... |
Junio C Hamano | fd9274d | 2009-08-05 21:21:39 | [diff] [blame] | 16 | |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 17 | 'git show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 18 | |
| 19 | DESCRIPTION |
| 20 | ----------- |
| 21 | |
| 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. |
| 25 | |
| 26 | It cannot show more than 29 branches and commits at a time. |
| 27 | |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [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 | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 31 | |
| 32 | OPTIONS |
| 33 | ------- |
| 34 | <rev>:: |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 35 | Arbitrary extended SHA1 expression (see linkgit:git-rev-parse[1]) |
Junio C Hamano | 54bf1e2 | 2008-12-20 06:30:11 | [diff] [blame] | 36 | that typically names a branch head or a tag. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 37 | |
| 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. |
| 43 | |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 44 | -r:: |
| 45 | --remotes:: |
Junio C Hamano | 30e1db1 | 2006-12-23 10:29:52 | [diff] [blame] | 46 | Show the remote-tracking branches. |
| 47 | |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 48 | -a:: |
| 49 | --all:: |
Junio C Hamano | 30e1db1 | 2006-12-23 10:29:52 | [diff] [blame] | 50 | Show both remote-tracking branches and local branches. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 51 | |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [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 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [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 | |
Junio C Hamano | cca5661 | 2009-06-03 08:27:33 | [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 | 872c568 | 2006-07-07 06:05:40 | [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 | 1a4e841 | 2005-12-27 08:17:23 | [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 |
| 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. |
| 80 | |
| 81 | --list:: |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 82 | Synonym to `--more=-1` |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 83 | |
| 84 | --merge-base:: |
Junio C Hamano | fd9274d | 2009-08-05 21:21:39 | [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 | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 90 | |
| 91 | --independent:: |
| 92 | Among the <reference>s given, display only the ones that |
| 93 | cannot be reached from any other <reference>. |
| 94 | |
| 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 | |
Junio C Hamano | 52401ef | 2006-12-19 00:54:38 | [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 | |
Junio C Hamano | a3bb6eb | 2009-02-05 01:26:33 | [diff] [blame] | 112 | -g:: |
Junio C Hamano | 16cf158 | 2007-02-05 07:21:48 | [diff] [blame] | 113 | --reflog[=<n>[,<base>]] [<ref>]:: |
Junio C Hamano | db450ba | 2007-01-21 08:57:14 | [diff] [blame] | 114 | Shows <n> most recent ref-log entries for the given |
| 115 | ref. If <base> is given, <n> entries going back from |
Junio C Hamano | fa0d4cf | 2007-01-25 02:23:58 | [diff] [blame] | 116 | that entry. <base> can be specified as count or date. |
Junio C Hamano | a3bb6eb | 2009-02-05 01:26:33 | [diff] [blame] | 117 | When no explicit <ref> parameter is given, it defaults to the |
Junio C Hamano | 16cf158 | 2007-02-05 07:21:48 | [diff] [blame] | 118 | current branch (or `HEAD` if it is detached). |
Junio C Hamano | d793de5 | 2006-12-26 09:11:43 | [diff] [blame] | 119 | |
Junio C Hamano | 52ba295 | 2009-05-18 17:43:02 | [diff] [blame] | 120 | --color:: |
| 121 | Color the status sign (one of these: `*` `!` `+` `-`) of each commit |
| 122 | corresponding to the branch it's in. |
| 123 | |
| 124 | --no-color:: |
| 125 | Turn off colored output, even when the configuration file gives the |
| 126 | default to color output. |
| 127 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 128 | Note that --more, --list, --independent and --merge-base options |
| 129 | are mutually exclusive. |
| 130 | |
| 131 | |
| 132 | OUTPUT |
| 133 | ------ |
| 134 | Given N <references>, the first N lines are the one-line |
| 135 | description from their commit message. The branch head that is |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 136 | pointed at by $GIT_DIR/HEAD is prefixed with an asterisk `*` |
| 137 | character while other heads are prefixed with a `!` character. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 138 | |
| 139 | Following these N lines, one-line log for each commit is |
| 140 | displayed, indented N places. If a commit is on the I-th |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 141 | branch, the I-th indentation character shows a `+` sign; |
| 142 | otherwise it shows a space. Merge commits are denoted by |
| 143 | a `-` sign. Each commit shows a short name that |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 144 | can be used as an extended SHA1 to name that commit. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 145 | |
| 146 | The following example shows three branches, "master", "fixes" |
| 147 | and "mhf": |
| 148 | |
| 149 | ------------------------------------------------ |
| 150 | $ git show-branch master fixes mhf |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 151 | * [master] Add 'git show-branch'. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 152 | ! [fixes] Introduce "reset type" flag to "git reset" |
| 153 | ! [mhf] Allow "+remote:local" refspec to cause --force when fetching. |
| 154 | --- |
| 155 | + [mhf] Allow "+remote:local" refspec to cause --force when fetching. |
| 156 | + [mhf~1] Use git-octopus when pulling more than one heads. |
| 157 | + [fixes] Introduce "reset type" flag to "git reset" |
| 158 | + [mhf~2] "git fetch --force". |
| 159 | + [mhf~3] Use .git/remote/origin, not .git/branches/origin. |
| 160 | + [mhf~4] Make "git pull" and "git fetch" default to origin |
| 161 | + [mhf~5] Infamous 'octopus merge' |
| 162 | + [mhf~6] Retire git-parse-remote. |
| 163 | + [mhf~7] Multi-head fetch. |
| 164 | + [mhf~8] Start adding the $GIT_DIR/remotes/ support. |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 165 | *++ [master] Add 'git show-branch'. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 166 | ------------------------------------------------ |
| 167 | |
| 168 | These three branches all forked from a common commit, [master], |
Junio C Hamano | f458110 | 2009-04-25 08:29:59 | [diff] [blame] | 169 | whose commit message is "Add \'git show-branch\'". The "fixes" |
| 170 | branch adds one commit "Introduce "reset type" flag to "git reset"". |
| 171 | The "mhf" branch adds many other commits. The current branch |
| 172 | is "master". |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 173 | |
| 174 | |
| 175 | EXAMPLE |
| 176 | ------- |
| 177 | |
| 178 | If you keep your primary branches immediately under |
| 179 | `$GIT_DIR/refs/heads`, and topic branches in subdirectories of |
| 180 | it, having the following in the configuration file may help: |
| 181 | |
| 182 | ------------ |
| 183 | [showbranch] |
| 184 | default = --topo-order |
| 185 | default = heads/* |
| 186 | |
| 187 | ------------ |
| 188 | |
Junio C Hamano | 2b13527 | 2006-03-18 07:45:42 | [diff] [blame] | 189 | With this, `git show-branch` without extra parameters would show |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 190 | only the primary branches. In addition, if you happen to be on |
| 191 | your topic branch, it is shown as well. |
| 192 | |
Junio C Hamano | db450ba | 2007-01-21 08:57:14 | [diff] [blame] | 193 | ------------ |
Junio C Hamano | f62a11d | 2008-12-21 12:16:36 | [diff] [blame] | 194 | $ git show-branch --reflog="10,1 hour ago" --list master |
Junio C Hamano | db450ba | 2007-01-21 08:57:14 | [diff] [blame] | 195 | ------------ |
| 196 | |
| 197 | shows 10 reflog entries going back from the tip as of 1 hour ago. |
| 198 | Without `--list`, the output also shows how these tips are |
| 199 | topologically related with each other. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 200 | |
| 201 | |
| 202 | Author |
| 203 | ------ |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 204 | Written by Junio C Hamano <gitster@pobox.com> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 205 | |
| 206 | |
| 207 | Documentation |
| 208 | -------------- |
| 209 | Documentation by Junio C Hamano. |
| 210 | |
| 211 | |
| 212 | GIT |
| 213 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 214 | Part of the linkgit:git[1] suite |