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