{
    "mode": "man",
    "parameter": "git-show-branch",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/git-show-branch/1/json",
    "generated": "2026-06-17T13:20:31Z",
    "synopsis": "git show-branch [-a|--all] [-r|--remotes] [--topo-order | --date-order]\n[--current] [--color[=<when>] | --no-color] [--sparse]\n[--more=<n> | --list | --independent | --merge-base]\n[--no-name | --sha1-name] [--topics]\n[(<rev> | <glob>)...]\ngit show-branch (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]",
    "sections": {
        "NAME": {
            "content": "git-show-branch - Show branches and their commits\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "git show-branch [-a|--all] [-r|--remotes] [--topo-order | --date-order]\n[--current] [--color[=<when>] | --no-color] [--sparse]\n[--more=<n> | --list | --independent | --merge-base]\n[--no-name | --sha1-name] [--topics]\n[(<rev> | <glob>)...]\ngit show-branch (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Shows the commit ancestry graph starting from the commits named with <rev>s or <glob>s (or\nall refs under refs/heads and/or refs/tags) semi-visually.\n\nIt cannot show more than 29 branches and commits at a time.\n\nIt uses showbranch.default multi-valued configuration items if no <rev> or <glob> is given on\nthe command line.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "<rev>\nArbitrary extended SHA-1 expression (see gitrevisions(7)) that typically names a branch\nhead or a tag.\n\n<glob>\nA glob pattern that matches branch or tag names under refs/. For example, if you have\nmany topic branches under refs/heads/topic, giving topic/* would show all of them.\n",
            "subsections": [
                {
                    "name": "-r, --remotes",
                    "content": "Show the remote-tracking branches.\n",
                    "flag": "-r",
                    "long": "--remotes"
                },
                {
                    "name": "-a, --all",
                    "content": "Show both remote-tracking branches and local branches.\n",
                    "flag": "-a",
                    "long": "--all"
                },
                {
                    "name": "--current",
                    "content": "With this option, the command includes the current branch to the list of revs to be shown\nwhen it is not given on the command line.\n",
                    "long": "--current"
                },
                {
                    "name": "--topo-order",
                    "content": "By default, the branches and their commits are shown in reverse chronological order. This\noption makes them appear in topological order (i.e., descendant commits are shown before\ntheir parents).\n",
                    "long": "--topo-order"
                },
                {
                    "name": "--date-order",
                    "content": "This option is similar to --topo-order in the sense that no parent comes before all of\nits children, but otherwise commits are ordered according to their commit date.\n",
                    "long": "--date-order"
                },
                {
                    "name": "--sparse",
                    "content": "By default, the output omits merges that are reachable from only one tip being shown.\nThis option makes them visible.\n\n--more=<n>\nUsually the command stops output upon showing the commit that is the common ancestor of\nall the branches. This flag tells the command to go <n> more common commits beyond that.\nWhen <n> is negative, display only the <reference>s given, without showing the commit\nancestry tree.\n",
                    "long": "--sparse"
                },
                {
                    "name": "--list",
                    "content": "Synonym to --more=-1\n",
                    "long": "--list"
                },
                {
                    "name": "--merge-base",
                    "content": "Instead of showing the commit list, determine possible merge bases for the specified\ncommits. All merge bases will be contained in all specified commits. This is different\nfrom how git-merge-base(1) handles the case of three or more commits.\n",
                    "long": "--merge-base"
                },
                {
                    "name": "--independent",
                    "content": "Among the <reference>s given, display only the ones that cannot be reached from any other\n<reference>.\n",
                    "long": "--independent"
                },
                {
                    "name": "--no-name",
                    "content": "Do not show naming strings for each commit.\n",
                    "long": "--no-name"
                },
                {
                    "name": "--sha1-name",
                    "content": "Instead of naming the commits using the path to reach them from heads (e.g. \"master~2\" to\nmean the grandparent of \"master\"), name them with the unique prefix of their object\nnames.\n",
                    "long": "--sha1-name"
                },
                {
                    "name": "--topics",
                    "content": "Shows only commits that are NOT on the first branch given. This helps track topic\nbranches by hiding any commit that is already in the main line of development. When given\n\"git show-branch --topics master topic1 topic2\", this will show the revisions given by\n\"git rev-list ^master topic1 topic2\"\n\n-g, --reflog[=<n>[,<base>]] [<ref>]\nShows <n> most recent ref-log entries for the given ref. If <base> is given, <n> entries\ngoing back from that entry. <base> can be specified as count or date. When no explicit\n<ref> parameter is given, it defaults to the current branch (or HEAD if it is detached).\n\n--color[=<when>]\nColor the status sign (one of these: * !  + -) of each commit corresponding to the branch\nit’s in. The value must be always (the default), never, or auto.\n",
                    "long": "--topics"
                },
                {
                    "name": "--no-color",
                    "content": "Turn off colored output, even when the configuration file gives the default to color\noutput. Same as --color=never.\n\nNote that --more, --list, --independent and --merge-base options are mutually exclusive.\n",
                    "long": "--no-color"
                }
            ]
        },
        "OUTPUT": {
            "content": "Given N <references>, the first N lines are the one-line description from their commit\nmessage. The branch head that is pointed at by $GITDIR/HEAD is prefixed with an asterisk *\ncharacter while other heads are prefixed with a ! character.\n\nFollowing these N lines, one-line log for each commit is displayed, indented N places. If a\ncommit is on the I-th branch, the I-th indentation character shows a + sign; otherwise it\nshows a space. Merge commits are denoted by a - sign. Each commit shows a short name that can\nbe used as an extended SHA-1 to name that commit.\n\nThe following example shows three branches, \"master\", \"fixes\" and \"mhf\":\n\n$ git show-branch master fixes mhf\n* [master] Add 'git show-branch'.\n! [fixes] Introduce \"reset type\" flag to \"git reset\"\n! [mhf] Allow \"+remote:local\" refspec to cause --force when fetching.\n---\n+ [mhf] Allow \"+remote:local\" refspec to cause --force when fetching.\n+ [mhf~1] Use git-octopus when pulling more than one heads.\n+  [fixes] Introduce \"reset type\" flag to \"git reset\"\n+ [mhf~2] \"git fetch --force\".\n+ [mhf~3] Use .git/remote/origin, not .git/branches/origin.\n+ [mhf~4] Make \"git pull\" and \"git fetch\" default to origin\n+ [mhf~5] Infamous 'octopus merge'\n+ [mhf~6] Retire git-parse-remote.\n+ [mhf~7] Multi-head fetch.\n+ [mhf~8] Start adding the $GITDIR/remotes/ support.\n*++ [master] Add 'git show-branch'.\n\n\nThese three branches all forked from a common commit, [master], whose commit message is \"Add\n'git show-branch'\". The \"fixes\" branch adds one commit \"Introduce \"reset type\" flag to \"git\nreset\"\". The \"mhf\" branch adds many other commits. The current branch is \"master\".\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "If you keep your primary branches immediately under refs/heads, and topic branches in\nsubdirectories of it, having the following in the configuration file may help:\n\n[showbranch]\ndefault = --topo-order\ndefault = heads/*\n\n\nWith this, git show-branch without extra parameters would show only the primary branches. In\naddition, if you happen to be on your topic branch, it is shown as well.\n\n$ git show-branch --reflog=\"10,1 hour ago\" --list master\n\n\nshows 10 reflog entries going back from the tip as of 1 hour ago. Without --list, the output\nalso shows how these tips are topologically related with each other.\n",
            "subsections": []
        },
        "GIT": {
            "content": "Part of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                           GIT-SHOW-BRANCH(1)",
            "subsections": []
        }
    },
    "summary": "git-show-branch - Show branches and their commits",
    "flags": [
        {
            "flag": "-r",
            "long": "--remotes",
            "arg": null,
            "description": "Show the remote-tracking branches."
        },
        {
            "flag": "-a",
            "long": "--all",
            "arg": null,
            "description": "Show both remote-tracking branches and local branches."
        },
        {
            "flag": "",
            "long": "--current",
            "arg": null,
            "description": "With this option, the command includes the current branch to the list of revs to be shown when it is not given on the command line."
        },
        {
            "flag": "",
            "long": "--topo-order",
            "arg": null,
            "description": "By default, the branches and their commits are shown in reverse chronological order. This option makes them appear in topological order (i.e., descendant commits are shown before their parents)."
        },
        {
            "flag": "",
            "long": "--date-order",
            "arg": null,
            "description": "This option is similar to --topo-order in the sense that no parent comes before all of its children, but otherwise commits are ordered according to their commit date."
        },
        {
            "flag": "",
            "long": "--sparse",
            "arg": null,
            "description": "By default, the output omits merges that are reachable from only one tip being shown. This option makes them visible. --more=<n> Usually the command stops output upon showing the commit that is the common ancestor of all the branches. This flag tells the command to go <n> more common commits beyond that. When <n> is negative, display only the <reference>s given, without showing the commit ancestry tree."
        },
        {
            "flag": "",
            "long": "--list",
            "arg": null,
            "description": "Synonym to --more=-1"
        },
        {
            "flag": "",
            "long": "--merge-base",
            "arg": null,
            "description": "Instead of showing the commit list, determine possible merge bases for the specified commits. All merge bases will be contained in all specified commits. This is different from how git-merge-base(1) handles the case of three or more commits."
        },
        {
            "flag": "",
            "long": "--independent",
            "arg": null,
            "description": "Among the <reference>s given, display only the ones that cannot be reached from any other <reference>."
        },
        {
            "flag": "",
            "long": "--no-name",
            "arg": null,
            "description": "Do not show naming strings for each commit."
        },
        {
            "flag": "",
            "long": "--sha1-name",
            "arg": null,
            "description": "Instead of naming the commits using the path to reach them from heads (e.g. \"master~2\" to mean the grandparent of \"master\"), name them with the unique prefix of their object names."
        },
        {
            "flag": "",
            "long": "--topics",
            "arg": null,
            "description": "Shows only commits that are NOT on the first branch given. This helps track topic branches by hiding any commit that is already in the main line of development. When given \"git show-branch --topics master topic1 topic2\", this will show the revisions given by \"git rev-list ^master topic1 topic2\" -g, --reflog[=<n>[,<base>]] [<ref>] Shows <n> most recent ref-log entries for the given ref. If <base> is given, <n> entries going back from that entry. <base> can be specified as count or date. When no explicit <ref> parameter is given, it defaults to the current branch (or HEAD if it is detached). --color[=<when>] Color the status sign (one of these: * ! + -) of each commit corresponding to the branch it’s in. The value must be always (the default), never, or auto."
        },
        {
            "flag": "",
            "long": "--no-color",
            "arg": null,
            "description": "Turn off colored output, even when the configuration file gives the default to color output. Same as --color=never. Note that --more, --list, --independent and --merge-base options are mutually exclusive."
        }
    ],
    "examples": [
        "If you keep your primary branches immediately under refs/heads, and topic branches in",
        "subdirectories of it, having the following in the configuration file may help:",
        "[showbranch]",
        "default = --topo-order",
        "default = heads/*",
        "With this, git show-branch without extra parameters would show only the primary branches. In",
        "addition, if you happen to be on your topic branch, it is shown as well.",
        "$ git show-branch --reflog=\"10,1 hour ago\" --list master",
        "shows 10 reflog entries going back from the tip as of 1 hour ago. Without --list, the output",
        "also shows how these tips are topologically related with each other."
    ],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Show branches and their commits.",
        "examples": [
            {
                "description": "Show a summary of the latest commit on a branch",
                "command": "git show-branch {{branch_name|ref|commit}}"
            },
            {
                "description": "Compare commits in the history of multiple commits or branches",
                "command": "git show-branch {{branch_name1|ref1|commit1 branch_name2|ref2|commit2 ...}}"
            },
            {
                "description": "Compare all remote tracking branches",
                "command": "git show-branch {{-r|--remotes}}"
            },
            {
                "description": "Compare both local and remote tracking branches",
                "command": "git show-branch {{-a|--all}}"
            },
            {
                "description": "List the latest commits in all branches",
                "command": "git show-branch {{-a|--all}} --list"
            },
            {
                "description": "Compare a given branch with the current branch",
                "command": "git show-branch --current {{commit|branch_name|ref}}"
            },
            {
                "description": "Display the commit name instead of the relative name",
                "command": "git show-branch --sha1-name --current {{current|branch_name|ref}}"
            },
            {
                "description": "Keep going a given number of commits past the common ancestor",
                "command": "git show-branch --more {{5}} {{branch_name1|ref1|commit1 branch_name2|ref2|commit2 ...}}"
            }
        ]
    }
}