Progress:
TIER 2 · MODULE 09· Intermediate

git refs

Switching from files to reftable, etc. Plumbing-adjacent.

🎯 What & why

git refs is the porcelain for the refs backend itself, not for individual references. It exists because Git is migrating from the ancient files backend to reftable, and someone has to drive that.

🧠 Mental model

Think of it as fsck/migrate for the ref storage layer. You don't use it daily; you use it once when you flip a repo from files to reftable, or when you want to audit the backend's integrity.

🛠️ Synopsis

git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]
git refs list
git refs verify [--strict] [--verbose]

🎚️ Switches & options

FlagWhat it does
--ref-format=<fmt>Target backend: files or reftable. The whole point of migrate.
--no-reflogSkip reflog entries during migration. Faster, lossy — you lose history of ref movement.
--dry-runShow what would happen without touching the repo. Always run this first.
--strictOn verify, treat warnings as errors. Use in CI.
--ref-format=files⚠️ Migrating back to files from reftable is supported but rarely what you want; reftable is the future.
-v / --verbosePrint every ref touched. Useful for debugging a stuck migration.

📦 Subcommands

migrate — Convert the on-disk refs backend in place.
git refs migrate --ref-format=reftable --dry-run
list — Print which backend the repo currently uses.
git refs list
verify — Check refs backend consistency. Cheaper than full git fsck.
git refs verify --strict

💡 Use cases

🧪 Examples

Check current backend
git refs list
Dry-run a reftable migration
git refs migrate --ref-format=reftable --dry-run
Actually migrate, keeping reflogs
git refs migrate --ref-format=reftable
Strict integrity check
git refs verify --strict --verbose

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.