Sapling
Meta’s source control system, grown out of Mercurial: an open-source sl client that works with Git repositories and makes stacks of commits and undo easy, plus a server and virtual filesystem that scale it to Meta’s monorepo.
- What it is
- Version control
- Type
- Open source
- Made by
- Meta
- License
- GPLv2 (MIT for the website and the ISL web UI)
- Facts checked
- 20 October 2026
What it is
Sapling is the source control client Meta uses for its monorepo, open-sourced in November 2022. It started as an extension to Mercurial and grew into a system of its own, and its sl command still shares much of Mercurial’s interface. Like Git it is distributed and uses hash-addressed commits, but each command does one thing: there is no staging area, local branch names (called bookmarks) are optional, and running sl with no arguments prints the smartlog, a graph of your own commits and the important remote branches, with the thousands of irrelevant commits on main hidden. Commits form stacks: you sl goto a commit in the middle, sl amend it, and Sapling rebases the commits above it, tracking each commit’s mutation history so the stack can be rebuilt later. sl undo, sl uncommit, sl unamend and sl hide reverse common mistakes.
The full system has three parts. The client builds and runs on Linux, macOS and Windows, clones and works with ordinary Git repositories, and can submit a stack of commits to GitHub as pull requests with sl pr submit; sl web opens the same smartlog as an interactive web UI. Mononoke, a distributed server written mostly in Rust, and EdenFS, a virtual filesystem that fills in working-copy files only when they are read, run in production at Meta. Their code is in the same repository, but Meta doesn’t yet support either outside the company. With them, Sapling serves a repository with tens of millions of files, commits and branches.
The goal is that every operation scales with the files a developer uses, not with the size of the repository. A clone downloads almost no history: Segmented Changelog fetches the shape of the commit graph in a few megabytes and fills in commits on demand, so smartlog takes under a second however big the repository is, and log and blame bisect the graph in O(log n) time, even on Git repositories. Without EdenFS, Watchman tells sl status which files changed, and teams can commit shared “sparse profiles” listing which parts of the repository to check out. Many scale features need Meta’s server, so they don’t apply to Git repositories. The latest release is 0.2.20260929 (September 29, 2026).
Why teams pick it
- Stacks of small commits are first-class: edit any commit in place and the rest restack automatically, and
sl absorbmoves pending edits into the right commit - Easy to recover from mistakes:
undo,redo,uncommit,unamend,hideand an interactiveundo -ithat scrolls back through old smartlog views - Works with existing Git repositories and GitHub, so one developer can try it without the team switching
- Built to scale with the files you use: lazy history, shared sparse profiles and, with Meta’s server and EdenFS, repositories of tens of millions of files
Watch out for
- The biggest scale features need Mononoke and EdenFS, which Meta doesn’t yet support outside the company
- Git support has gaps: submodules aren’t fully supported, Git LFS only partly, and mixing
slandgitcommands in one repository might not always work - Stacks submitted with
sl prshow up as overlapping pull requests that can confuse reviewers using GitHub’s own UI - Fetching history and branches on demand saves downloads at the cost of needing to be online more often than with Git
Alternatives
What all version control have in common →Compare side by side →jj, where the working copy is itself a commit, every operation can be undone, and conflicts are stored in commits instead of stopping you.How it fits with other technologies
What Sapling uses
Try Sapling on a Git repository · bash
sl clone https://github.com/facebook/sapling
cd sapling
sl # the smartlog: your commits, where you are, main
sl commit -m 'my first commit with Sapling'
sl goto COMMIT # move to a commit in the middle of your stack
sl amend # change it; the commits above are rebased
sl absorb # fold pending edits into the commits they belong to
sl undo # take back the last operation
sl pr submit # one GitHub pull request per commit in the stack
sl web # the interactive smartlog in a browserThe three parts of Sapling#
Only the client is supported outside Meta; the server and filesystem are buildable from the same repository for unsupported experiments.
Sapling client
open sourceThe sl command line and the Interactive Smartlog web UI, also built into VS Code. It works with Git repositories in two modes: .git mode keeps Git’s file formats so git commands still work, and .sl mode gives up git commands for more of Sapling’s scale features.
Mononoke
the serverA distributed server written mostly in Rust, meant to accept thousands of commits an hour across millions of files. Its open-source build can store data in MySQL, SQLite, files or S3. With it, sl push lets the server rebase your commits onto the branch, so many pushes can succeed at once.
EdenFS
virtual filesystemMakes a checkout look like the whole repository but fetches each file the first time it is read. Checkouts become fast, at the cost of a small delay on first access to a file.
See it in a real stack
No architecture uses Sapling yet. Drop it into the playground and wire it up yourself.Open playground →Where it came from2012–2026
Around 2012 Facebook projected its repository’s growth a few years ahead and saw that its setup, a Subversion server with a Git mirror, would soon become a bottleneck. By early 2014 the main repository took thousands of commits a week across hundreds of thousands of files. Splitting it would have made large atomic refactorings harder, and its engineers knew Git, but after much deliberation the team concluded that Git’s internals would be difficult to work with for an ambitious scaling project. It chose Mercurial, written mostly in clean, modular Python and easy to extend, and contributed over 500 patches to it in a year and a half.
That early work set Sapling’s shape. Integration with Watchman, Facebook’s file monitor, let status find changed files without scanning them all, making it more than five times faster than Git’s status on that repository. The remotefilelog extension made clone and pull download only commit metadata and fetch file contents on demand through Facebook’s memcache, making them 10 times faster. What began as a Mercurial extension grew into a system of its own, with new storage formats, wire protocols and algorithms, and a new server, Mononoke, whose early code Meta published in 2017.
On November 15, 2022, after 10 years of work, Meta open-sourced the client as Sapling, with built-in Git support so anyone could try it on their existing repositories, alongside ReviewStack, a demonstration review UI for stacked GitHub pull requests. It said it hoped to open-source the server and virtual filesystem later; their code now sits in the same repository, still unsupported outside Meta. In October 2026 Anthropic named Mononoke and its Bonsai data model as prior art for Scion, its own version control system.
Why it’s built this way
- Make Mercurial scale instead of splitting the repository
- One repository made large, atomic changes across the codebase easy, and the team didn’t want source control limits to dictate code structure. Mercurial’s modular Python was easier to extend than Git’s internals, and its community reviewed the patches with Facebook’s scale in mind.
- Fetch history and files lazily
- With thousands of commits a day, downloading all history to every client was slow. Fetching metadata first and contents on demand sits between a centralized system’s speed and a distributed one’s robustness, at the cost of needing a reliable server and network.
- Make stacks and undo first-class
- Meta engineers ship features as stacks of small, individually reviewed commits, which in Git takes complex commands such as
git rebase -i. The Sapling team was small and had to support tens of thousands of developers, so people needed to be able to fix their own mistakes.
Timeline
- 2012
Work begins on scaling Facebook’s monorepo, as an extension to Mercurial
- 2014
Facebook describes its Mercurial work: Watchman, remotefilelog and over 500 patches (January 7)
- 2017
Early code for the Mononoke server published on GitHub (May)
- 2022
Sapling client open-sourced, with Git support and ReviewStack (November 15)
- 2026
Release 0.2.20260929 (September 29); Anthropic cites Mononoke as prior art for Scion (October)
- Engineering at Meta: Scaling Mercurial at Facebook (Jan 7, 2014)
- Engineering at Meta: Sapling, source control that’s user-friendly and scalable (Nov 15, 2022)
- facebookexperimental/mononoke on GitHub: a Mercurial source control server for large monorepos (created May 2017, archived)
- facebook/sapling on GitHub: release 0.2.20260929 (Sep 29, 2026)
- Anthropic Engineering: Redesigning source control at Anthropic (Oct 13, 2026; Mononoke and Bonsai as prior art)
Sources10 · facts checked 20 October 2026
- Engineering at Meta: Sapling, source control that’s user-friendly and scalable (Nov 15, 2022)
- facebook/sapling on GitHub: README (client, Mononoke, EdenFS, platforms, licenses)
- facebook/sapling on GitHub: Mononoke README (Rust, MySQL, SQLite, file and S3 backends)
- facebook/sapling on GitHub: LICENSE (GPLv2)
- Sapling docs: Differences from Git (no staging area, optional bookmarks, pushrebase, sparse profiles)
- Sapling docs: Git support modes (.git and .sl modes, submodules, Git LFS)
- Sapling docs: Using Sapling with GitHub (sl pr, overlapping pull requests)
- Sapling docs: Getting started (sl clone, sl commit, sl pr submit)
- Sapling docs: Interactive Smartlog (sl web)
- facebook/sapling on GitHub: release 0.2.20260929 (Sep 29, 2026)