AI summary by TwinMind
Why doesn't Facebook use git?
Theo - t3․gg
20m 6s
Background and Context
- Facebook doesn't use Git - story documented by Graphite (channel sponsor)
- Graphite built by ex-Facebook engineers who missed Facebook's version control workflows
- Specifically inspired by "stacked diffs" concept from Facebook
- Greg Foster (Graphite) researched this topic extensively, interviewed original Facebook engineers who worked on migration project
- Facebook founded 2004, same time as Git creation
- By 2012, Facebook hitting scaling limits with Git
Performance Issues and Scaling Problems
- Facebook codebase "many times larger than Linux kernel" (17 million lines, 44,000 files)
- Git operations becoming slow - not crippling but warranting investigation
- Key bottleneck: staging process - Git examines every file, becomes slower as file count increases
- Facebook ran simulation creating dummy repo matching expected future scale
- Results: basic Git commands took over 45 minutes to complete
- Quote from original engineer: "not the type of thing you would want to leave until all engineers are complaining"
Git Maintainers' Response
- Facebook contacted Git maintainers about extending Git for larger monorepos
- Git maintainers' responses (from email threads):
- "Split up the massive repositories to separate smaller repositories"
- "You should split up repositories... there is IMHO no downsides"
- "While git could be better with large repositories... there's only so much you can do about staging 1.3 million files"
- Facebook team surprised by Git's unwillingness to accept collaboration
- Git maintainers pushed back on performance improvements, recommended sharding monorepo
- Sharding was non-starter for Facebook team due to monorepo benefits (synchronization, atomic changes)
Alternative Solutions Considered
- Perforce: Facebook found architectural flaw in local consistency between reader/writer nodes
- Sales engineers unaware of fundamental issue, no roadmap to address
- BitKeeper: considered but disqualified
- Mercurial: last remaining option with performance similar to Git
Why Mercurial Was Chosen
- Performance similar to Git but cleaner architecture
- Git: complex web of bash and C code
- Mercurial: engineered in Python using object-oriented patterns, designed to be extensible
- One investigating engineer had strong prior Mercurial experience
- Team attended Mercurial hackathon in Amsterdam
- Found system easy to extend with welcoming community of maintainers
- Mercurial maintainers receptive to aggressive changes by Facebook team
Internal Migration Strategy
- Team spent months socializing migration possibilities
- Mapped all common commands/workflows between Git and Mercurial
- Sourced frequency of specific Git commands across company
- Documented how most frequent operations would work in Mercurial
- Created opportunities for developers to voice concerns
- Expected flame wars over edge cases but found engineers accommodating
- Quote: "no one stood up and started screaming about their special situation"
Results and Impact
- Facebook contributed performance improvements to Mercurial
- Made Mercurial best option for large monorepos
- Evan Priestley extended Fabricator to support Mercurial
- Facebook leveraged Mercurial's diff concept to create stacked diffs pattern
- Unlocked new level of code review parallelization
- Ex-Facebook engineers brought workflow to new companies (Uber, Pinterest also used Mercurial/Fabricator)
- Created "small but vocal cult of stack diff enthusiasts"
Microsoft's Later Git Improvements
- Took Microsoft 5-7 years to make Git scale properly
- Microsoft introduced Git LFS (Large File Systems) for handling large files
- Microsoft's acquisition of GitHub motivated Git scaling investments
- Facebook's rejection by Git maintainers arguably enabled Microsoft's later Git contributions
Key Takeaways
- Decision was human-driven, not purely technology-driven
- Facebook adopted Mercurial not because more performant, but because maintainers/codebase felt more open to collaboration
- Face-to-face meetings with Mercurial maintainers created partnership opportunity
- Internal adoption succeeded through thoughtful communication, not technical superiority
- Kindness and openness important in dev tools world
