{
    "mode": "man",
    "parameter": "git-prune",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/git-prune/1/json",
    "generated": "2026-05-30T05:09:46Z",
    "synopsis": "git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]",
    "sections": {
        "NAME": {
            "content": "git-prune - Prune all unreachable objects from the object database\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Note\nIn most cases, users should run git gc, which calls git prune. See the section \"NOTES\",\nbelow.\n\nThis runs git fsck --unreachable using all the refs available in refs/, optionally with\nadditional set of objects specified on the command line, and prunes all unpacked objects\nunreachable from any of these head objects from the object database. In addition, it prunes\nthe unpacked objects that are also found in packs by running git prune-packed. It also\nremoves entries from .git/shallow that are not reachable by any ref.\n\nNote that unreachable, packed objects will remain. If this is not desired, see git-repack(1).\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-n, --dry-run",
                    "content": "Do not remove anything; just report what it would remove.\n",
                    "flag": "-n",
                    "long": "--dry-run"
                },
                {
                    "name": "-v, --verbose",
                    "content": "Report all removed objects.\n",
                    "flag": "-v",
                    "long": "--verbose"
                },
                {
                    "name": "--progress",
                    "content": "Show progress.\n",
                    "long": "--progress"
                },
                {
                    "name": "--expire <time>",
                    "content": "Only expire loose objects older than <time>.\n\n--\nDo not interpret any more arguments as options.\n\n<head>...\nIn addition to objects reachable from any of our references, keep objects reachable from\nlisted <head>s.\n",
                    "long": "--expire",
                    "arg": "<time>"
                }
            ]
        },
        "EXAMPLES": {
            "content": "To prune objects not used by your repository or another that borrows from your repository via\nits .git/objects/info/alternates:\n\n$ git prune $(cd ../another && git rev-parse --all)\n\n",
            "subsections": []
        },
        "NOTES": {
            "content": "In most cases, users will not need to call git prune directly, but should instead call git\ngc, which handles pruning along with many other housekeeping tasks.\n\nFor a description of which objects are considered for pruning, see git fsck's --unreachable\noption.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "git-fsck(1), git-gc(1), git-reflog(1)\n",
            "subsections": []
        },
        "GIT": {
            "content": "Part of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                                 GIT-PRUNE(1)",
            "subsections": []
        }
    },
    "summary": "git-prune - Prune all unreachable objects from the object database",
    "flags": [
        {
            "flag": "-n",
            "long": "--dry-run",
            "arg": null,
            "description": "Do not remove anything; just report what it would remove."
        },
        {
            "flag": "-v",
            "long": "--verbose",
            "arg": null,
            "description": "Report all removed objects."
        },
        {
            "flag": "",
            "long": "--progress",
            "arg": null,
            "description": "Show progress."
        },
        {
            "flag": "",
            "long": "--expire",
            "arg": "<time>",
            "description": "Only expire loose objects older than <time>. -- Do not interpret any more arguments as options. <head>... In addition to objects reachable from any of our references, keep objects reachable from listed <head>s."
        }
    ],
    "examples": [
        "To prune objects not used by your repository or another that borrows from your repository via",
        "its .git/objects/info/alternates:",
        "$ git prune $(cd ../another && git rev-parse --all)"
    ],
    "see_also": [
        {
            "name": "git-fsck",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/git-fsck/1/json"
        },
        {
            "name": "git-gc",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/git-gc/1/json"
        },
        {
            "name": "git-reflog",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/git-reflog/1/json"
        }
    ]
}