{
    "mode": "man",
    "parameter": "GIT-CHERRY",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/GIT-CHERRY/1/json",
    "generated": "2026-06-15T13:16:08Z",
    "synopsis": "git cherry [-v] [<upstream> [<head> [<limit>]]]",
    "sections": {
        "NAME": {
            "content": "git-cherry - Find commits yet to be applied to upstream\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "git cherry [-v] [<upstream> [<head> [<limit>]]]\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Determine whether there are commits in <head>..<upstream> that are equivalent to those in the\nrange <limit>..<head>.\n\nThe equivalence test is based on the diff, after removing whitespace and line numbers.\ngit-cherry therefore detects when commits have been \"copied\" by means of git-cherry-pick(1),\ngit-am(1) or git-rebase(1).\n\nOutputs the SHA1 of every commit in <limit>..<head>, prefixed with - for commits that have an\nequivalent in <upstream>, and + for commits that do not.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-v",
                    "content": "Show the commit subjects next to the SHA1s.\n\n<upstream>\nUpstream branch to search for equivalent commits. Defaults to the upstream branch of\nHEAD.\n\n<head>\nWorking branch; defaults to HEAD.\n\n<limit>\nDo not report commits up to (and including) limit.\n",
                    "flag": "-v"
                }
            ]
        },
        "EXAMPLES": {
            "content": "",
            "subsections": [
                {
                    "name": "Patch workflows",
                    "content": "git-cherry is frequently used in patch-based workflows (see gitworkflows(7)) to determine if\na series of patches has been applied by the upstream maintainer. In such a workflow you might\ncreate and send a topic branch like this:\n\n$ git checkout -b topic origin/master\n# work and create some commits\n$ git format-patch origin/master\n$ git send-email ... 00*\n\n\nLater, you can see whether your changes have been applied by saying (still on topic):\n\n$ git fetch  # update your notion of origin/master\n$ git cherry -v\n\n"
                },
                {
                    "name": "Concrete example",
                    "content": "In a situation where topic consisted of three commits, and the maintainer applied two of\nthem, the situation might look like:\n\n$ git log --graph --oneline --decorate --boundary origin/master...topic\n* 7654321 (origin/master) upstream tip commit\n[... snip some other commits ...]\n* cccc111 cherry-pick of C\n* aaaa111 cherry-pick of A\n[... snip a lot more that has happened ...]\n| * cccc000 (topic) commit C\n| * bbbb000 commit B\n| * aaaa000 commit A\n|/\no 1234567 branch point\n\n\nIn such cases, git-cherry shows a concise summary of what has yet to be applied:\n\n$ git cherry origin/master topic\n- cccc000... commit C\n+ bbbb000... commit B\n- aaaa000... commit A\n\n\nHere, we see that the commits A and C (marked with -) can be dropped from your topic branch\nwhen you rebase it on top of origin/master, while the commit B (marked with +) still needs to\nbe kept so that it will be sent to be applied to origin/master.\n"
                },
                {
                    "name": "Using a limit",
                    "content": "The optional <limit> is useful in cases where your topic is based on other work that is not\nin upstream. Expanding on the previous example, this might look like:\n\n$ git log --graph --oneline --decorate --boundary origin/master...topic\n* 7654321 (origin/master) upstream tip commit\n[... snip some other commits ...]\n* cccc111 cherry-pick of C\n* aaaa111 cherry-pick of A\n[... snip a lot more that has happened ...]\n| * cccc000 (topic) commit C\n| * bbbb000 commit B\n| * aaaa000 commit A\n| * 0000fff (base) unpublished stuff F\n[... snip ...]\n| * 0000aaa unpublished stuff A\n|/\no 1234567 merge-base between upstream and topic\n\n\nBy specifying base as the limit, you can avoid listing commits between base and topic:\n\n$ git cherry origin/master topic base\n- cccc000... commit C\n+ bbbb000... commit B\n- aaaa000... commit A\n\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "git-patch-id(1)\n",
            "subsections": []
        },
        "GIT": {
            "content": "Part of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                                GIT-CHERRY(1)",
            "subsections": []
        }
    },
    "summary": "git-cherry - Find commits yet to be applied to upstream",
    "flags": [
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": "Show the commit subjects next to the SHA1s. <upstream> Upstream branch to search for equivalent commits. Defaults to the upstream branch of HEAD. <head> Working branch; defaults to HEAD. <limit> Do not report commits up to (and including) limit."
        }
    ],
    "examples": [
        "git-cherry is frequently used in patch-based workflows (see gitworkflows(7)) to determine if",
        "a series of patches has been applied by the upstream maintainer. In such a workflow you might",
        "create and send a topic branch like this:",
        "$ git checkout -b topic origin/master",
        "# work and create some commits",
        "$ git format-patch origin/master",
        "$ git send-email ... 00*",
        "Later, you can see whether your changes have been applied by saying (still on topic):",
        "$ git fetch  # update your notion of origin/master",
        "$ git cherry -v",
        "In a situation where topic consisted of three commits, and the maintainer applied two of",
        "them, the situation might look like:",
        "$ git log --graph --oneline --decorate --boundary origin/master...topic",
        "* 7654321 (origin/master) upstream tip commit",
        "[... snip some other commits ...]",
        "* cccc111 cherry-pick of C",
        "* aaaa111 cherry-pick of A",
        "[... snip a lot more that has happened ...]",
        "| * cccc000 (topic) commit C",
        "| * bbbb000 commit B",
        "| * aaaa000 commit A",
        "|/",
        "o 1234567 branch point",
        "In such cases, git-cherry shows a concise summary of what has yet to be applied:",
        "$ git cherry origin/master topic",
        "- cccc000... commit C",
        "+ bbbb000... commit B",
        "- aaaa000... commit A",
        "Here, we see that the commits A and C (marked with -) can be dropped from your topic branch",
        "when you rebase it on top of origin/master, while the commit B (marked with +) still needs to",
        "be kept so that it will be sent to be applied to origin/master.",
        "The optional <limit> is useful in cases where your topic is based on other work that is not",
        "in upstream. Expanding on the previous example, this might look like:",
        "$ git log --graph --oneline --decorate --boundary origin/master...topic",
        "* 7654321 (origin/master) upstream tip commit",
        "[... snip some other commits ...]",
        "* cccc111 cherry-pick of C",
        "* aaaa111 cherry-pick of A",
        "[... snip a lot more that has happened ...]",
        "| * cccc000 (topic) commit C",
        "| * bbbb000 commit B",
        "| * aaaa000 commit A",
        "| * 0000fff (base) unpublished stuff F",
        "[... snip ...]",
        "| * 0000aaa unpublished stuff A",
        "|/",
        "o 1234567 merge-base between upstream and topic",
        "By specifying base as the limit, you can avoid listing commits between base and topic:",
        "$ git cherry origin/master topic base",
        "- cccc000... commit C",
        "+ bbbb000... commit B",
        "- aaaa000... commit A"
    ],
    "see_also": [
        {
            "name": "git-patch-id",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/git-patch-id/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Find commits that have yet to be applied upstream.",
        "examples": [
            {
                "description": "Show commits (and their messages) with equivalent commits upstream",
                "command": "git cherry {{-v|--verbose}}"
            },
            {
                "description": "Specify a different upstream and topic branch",
                "command": "git cherry {{origin}} {{topic}}"
            },
            {
                "description": "Limit commits to those within a given limit",
                "command": "git cherry {{origin}} {{topic}} {{base}}"
            }
        ]
    }
}