{
    "mode": "man",
    "parameter": "GIT-PACK-REFS",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/man/GIT-PACK-REFS/json",
    "generated": "2026-10-22T13:15:05Z",
    "synopsis": "git pack-refs [--all] [--no-prune] [--include <pattern>] [--exclude <pattern>]",
    "sections": {
        "NAME": {
            "content": "git-pack-refs - Pack heads and tags for efficient repository access\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "git pack-refs [--all] [--no-prune] [--include <pattern>] [--exclude <pattern>]\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Traditionally, tips of branches and tags (collectively known as refs) were stored one file\nper ref in a (sub)directory under $GITDIR/refs directory. While many branch tips tend to be\nupdated often, most tags and some branch tips are never updated. When a repository has\nhundreds or thousands of tags, this one-file-per-ref format both wastes storage and hurts\nperformance.\n\nThis command is used to solve the storage and performance problem by storing the refs in a\nsingle file, $GITDIR/packed-refs. When a ref is missing from the traditional $GITDIR/refs\ndirectory hierarchy, it is looked up in this file and used if found.\n\nSubsequent updates to branches always create new files under $GITDIR/refs directory\nhierarchy.\n\nA recommended practice to deal with a repository with too many refs is to pack its refs with\n--all once, and occasionally run git pack-refs. Tags are by definition stationary and are not\nexpected to change. Branch heads will be packed with the initial pack-refs --all, but only\nthe currently active branch heads will become unpacked, and the next pack-refs (without\n--all) will leave them unpacked.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "--all",
                    "content": "The command by default packs all tags and refs that are already packed, and leaves other\nrefs alone. This is because branches are expected to be actively developed and packing\ntheir tips does not help performance. This option causes all refs to be packed as well,\nwith the exception of hidden refs, broken refs, and symbolic refs. Useful for a\nrepository with many branches of historical interests.\n",
                    "long": "--all"
                },
                {
                    "name": "--no-prune",
                    "content": "The command usually removes loose refs under $GITDIR/refs hierarchy after packing them.\nThis option tells it not to.\n",
                    "long": "--no-prune"
                },
                {
                    "name": "--include <pattern>",
                    "content": "Pack refs based on a glob(7) pattern. Repetitions of this option accumulate inclusion\npatterns. If a ref is both included in --include and --exclude, --exclude takes\nprecedence. Using --include will preclude all tags from being included by default.\nSymbolic refs and broken refs will never be packed. When used with --all, it will be a\nnoop. Use --no-include to clear and reset the list of patterns.\n",
                    "long": "--include",
                    "arg": "<pattern>"
                },
                {
                    "name": "--exclude <pattern>",
                    "content": "Do not pack refs matching the given glob(7) pattern. Repetitions of this option\naccumulate exclusion patterns. Use --no-exclude to clear and reset the list of patterns.\nIf a ref is already packed, including it with --exclude will not unpack it.\n\nWhen used with --all, pack only loose refs which do not match any of the provided --exclude\npatterns.\n\nWhen used with --include, refs provided to --include, minus refs that are provided to\n--exclude will be packed.\n",
                    "long": "--exclude",
                    "arg": "<pattern>"
                }
            ]
        },
        "BUGS": {
            "content": "Older documentation written before the packed-refs mechanism was introduced may still say\nthings like \".git/refs/heads/<branch> file exists\" when it means \"branch <branch> exists\".\n",
            "subsections": []
        },
        "GIT": {
            "content": "Part of the git(1) suite\n\nGit 2.43.0                                   07/02/2025                             GIT-PACK-REFS(1)",
            "subsections": []
        }
    },
    "summary": "git-pack-refs - Pack heads and tags for efficient repository access",
    "flags": [
        {
            "flag": "",
            "long": "--all",
            "arg": null,
            "description": "The command by default packs all tags and refs that are already packed, and leaves other refs alone. This is because branches are expected to be actively developed and packing their tips does not help performance. This option causes all refs to be packed as well, with the exception of hidden refs, broken refs, and symbolic refs. Useful for a repository with many branches of historical interests."
        },
        {
            "flag": "",
            "long": "--no-prune",
            "arg": null,
            "description": "The command usually removes loose refs under $GITDIR/refs hierarchy after packing them. This option tells it not to."
        },
        {
            "flag": "",
            "long": "--include",
            "arg": "<pattern>",
            "description": "Pack refs based on a glob(7) pattern. Repetitions of this option accumulate inclusion patterns. If a ref is both included in --include and --exclude, --exclude takes precedence. Using --include will preclude all tags from being included by default. Symbolic refs and broken refs will never be packed. When used with --all, it will be a noop. Use --no-include to clear and reset the list of patterns."
        },
        {
            "flag": "",
            "long": "--exclude",
            "arg": "<pattern>",
            "description": "Do not pack refs matching the given glob(7) pattern. Repetitions of this option accumulate exclusion patterns. Use --no-exclude to clear and reset the list of patterns. If a ref is already packed, including it with --exclude will not unpack it. When used with --all, pack only loose refs which do not match any of the provided --exclude patterns. When used with --include, refs provided to --include, minus refs that are provided to --exclude will be packed."
        }
    ],
    "examples": [],
    "see_also": []
}