Why Facebook Doesn't Use Git
Based on The PrimeTime's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.
Git performance degraded at Facebook’s monorepo scale, with the cost tied to Git examining/statting large numbers of files.
Briefing
Facebook’s shift away from Git and toward Mercurial (and then custom tooling built on top of it) came down to one practical bottleneck: Git’s performance degraded as the company’s monorepo grew to massive scale. Around 2012, engineers began feeling Git operations slow down—not always catastrophically, but enough to justify a serious investigation. The key pain point wasn’t just “cloning feels slow”; it was the cost of Git examining (statting) huge numbers of files, with latency compounding as file counts rose.
A 2014 Facebook blog post (and later follow-ups) described Git’s scaling limits in terms of repository size. The company’s codebase was projected to grow far beyond what Git could handle comfortably. In a simulation meant to match expected growth, basic Git commands reportedly took over 45 minutes to complete. The prospect of waiting for “engineers are complaining” before fixing the problem was unacceptable; by the time that happened, the repository would be too unwieldy to rescue. The team concluded that damage control would be Herculean, so they pursued a cleaner solution early.
Before committing to Mercurial, the investigation explored alternatives. Perforce was considered, but an architectural flaw around local consistency between readers and writers undermined confidence. Other systems like BitKeeper were also evaluated and quickly ruled out. Mercurial emerged as the leading candidate because it offered performance comparable to Git while being architecturally simpler—implemented in Python with object-oriented patterns and designed to be extensible. That extensibility mattered: the team wanted a version control system that could be shaped to their needs rather than forcing their workflow to fit a tool that couldn’t scale.
The next phase focused on feasibility and adoption. Engineers attended a Mercurial hackathon in Amsterdam to validate that the Mercurial community was welcoming and that maintainers would support aggressive changes. Once convinced, the migration required winning over the rest of the organization—an inherently political and emotional process for developers whose daily workflows depend on tooling. The rollout avoided flame wars by mapping common Git commands and workflows to Mercurial equivalents, measuring which Git operations were used most, and creating channels for developers to raise edge cases.
After the company cut over to Mercurial, Facebook contributed performance improvements back to the project, helping make it a better fit for large monorepos. It also extended Fabricator to support Mercurial-style “diffs,” enabling “stacked changes” that unlock smoother code review and parallelization—changes that later influenced tools like Graphite. The broader takeaway from the accounts is that major engineering tool decisions are often driven by human factors—who is willing to collaborate, how migrations are socialized, and whether teams can translate workflow pain into a workable technical plan—more than by abstract technology comparisons alone.
Cornell Notes
Facebook’s move away from Git was driven by scaling pain: as the monorepo grew, Git operations slowed, largely because Git had to examine (stat) every file and the cost compounded with file count. Engineers projected that continued growth would make basic commands take unacceptably long, so they sought a system that could handle large monorepos without waiting for widespread complaints. After evaluating Perforce and other options, Mercurial won out for performance and for being extensible enough to support custom workflow needs. The migration succeeded not only through technical work, but through careful internal change management—mapping workflows, measuring command usage, and addressing developer concerns. The result included performance improvements to Mercurial and tooling built around stacked diffs for better code review and parallel development.
What specific Git scaling issue pushed Facebook to investigate alternatives?
Why didn’t simply “split the repo” solve the problem?
Which alternatives were considered before Mercurial, and what disqualified them?
What made Mercurial attractive beyond raw performance?
How did Facebook reduce resistance during the Git-to-Mercurial migration?
What workflow capability became a lasting advantage after the migration?
Review Questions
- What performance mechanism in Git became problematic as repository file counts increased, and how did that shape the decision timeline?
- Why was sharding rejected, and what alternative path did the team pursue instead?
- What combination of technical work and internal change management helped the migration avoid widespread developer backlash?
Key Points
- 1
Git performance degraded at Facebook’s monorepo scale, with the cost tied to Git examining/statting large numbers of files.
- 2
Projected growth made “wait until engineers complain” unacceptable, since the repository would become too unwieldy to fix later.
- 3
Perforce was evaluated but undermined by an architectural local-consistency flaw and a lack of credible roadmap to address it.
- 4
Mercurial was chosen for comparable performance and for extensibility that allowed Facebook to shape the system and workflows.
- 5
The migration succeeded through adoption planning: mapping workflows, measuring command usage, and creating structured feedback channels for edge cases.
- 6
After switching, Facebook contributed performance improvements back to Mercurial and built tooling around stacked diffs to improve code review and parallel development.