Senior LevelGit & GitHub
What is Index File Format v4 and how does prefix compression shrink the .git/index file?
❓ Interview Prompt: Explain Index File Format v4, pathname prefix compression, shrinking staging index disk footprints, and core.indexVersion.
Index Format v4 compresses pathnames in the staging index using path prefix compression, reducing .git/index file size on disk by up to 70% in large monorepos.
Code Implementation Example
bash
git config --global core.indexVersion 4
git update-index --index-version 4💡Upgrading repository index format to v4 for pathname prefix compression.
🎯 Interview Key Takeaway
Set core.indexVersion 4 to enable path prefix compression, reducing .git/index file size by 70% in large repositories.
#Index v4#Prefix Compression#Storage#Senior
Back to all Git & GitHub Questions→