Explain how a tree object is encoded and why renames are not stored.
AdvancedConceptGit internals: objects, refs and the index
Answer
A tree is a list of entries <mode> <name>\0<20-byte-binary-id> sorted by name. Modes include 100644 (file), 100755 (executable), 120000 (symlink), 040000 (tree) and 160000 (gitlink, a submodule). Git records no rename metadata; git log --follow, diff -M and blame -C detect renames heuristically by comparing blob similarity (default threshold 50%).
git ls-tree -r HEAD
git diff -M --stat HEAD~1
More on Git internals: objects, refs and the index
What are the four object types in Git's object database?BeginnerIs Git a snapshot system or a diff system?BeginnerWhat is the SHA-1 (or SHA-256) hash of an object and how is it computed?BeginnerWhere does Git store objects on disk, and what are loose objects versus packfiles?IntermediateWhat exactly is a branch, and what does creating one cost?IntermediateWhat is HEAD?Beginner