git pack-refs

Administration

Pack references into a single file


The 'git pack-refs' command moves references (branches, tags) from one small file each in .git/refs/ into the single file .git/packed-refs. Repositories with thousands of tags become faster. It changes storage only; git gc runs it automatically.

Synopsis

git pack-refs [--all] [--no-prune]
[ ] optional| or<arg> placeholder... repeatable--flag option

Examples

Pack all refs

git pack-refs --all

Branches and tags into packed-refs.

Workflow Examples

1
git pack-refs --all

Pack them

2
git tag | wc -l

Still all there

Troubleshooting

A branch file seems missing in .git/refs

Cause: It was packed

Look in .git/packed-refs — or just use git branch

Tips & Pitfalls

Best Practices

  • ✓Never edit .git/packed-refs by hand; use git update-ref.

FAQ

A:

No, only their storage.