Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 11 min read Announcement easyNovice

Sapling: Source control that’s user-friendly and scalable

Meta has open-sourced the client for Sapling, a Git-compatible source control system built over 10 years that scales to repositories with tens of millions of files, commits and branches. Its UX centers on smartlog (a filtered view of your relevant commits), extensive undo/recovery commands, and first-class commit stacks backed by tracked mutation history, plus ReviewStack, a demo UI for reviewing GitHub PRs commit by commit. For scale, Segmented Changelog downloads only the commit graph's shape and lazily fetches data, answering ancestry queries in O(number-of-merges) and file history in O(log n). Sparse profiles committed to the repo, Watchman integration, and a forthcoming virtual file system and Rust server handle the working copy.

Assumes: Git basicscommit stacks and rebasing

Related posts

  • Branching in a Sapling Monorepo

    Meta Engineering mediumAdept

    Meta's Sapling monorepo handles branching with two workflows: non-mergeable full-repo branching via sl bookmark for short-lived release branches, and mergeable directory branching via sl subtree for long-lived variants. Full-repo merges create multi-parent commits that slow sl log and sl blame for everyone. Directory branching instead records copy and merge metadata in linear commits, so Sapling can run scoped three-way merges between directories while the commit graph stays linear. Teams adopt it when CI is expensive, for long-running experimental work, and to unblock Git migrations. Buck2 config modifiers select which branch a build uses, and the main downside is duplicate code-search hits.

  • Redesigning source control at Anthropic

    Anthropic Engineering mediumAdept

    Anthropic replaced git with Scion, an in-house centralized version control system, after its monorepo grew past what git mirrors could serve. Merges went from about 2,500 to over 30,000 per day, main-branch history approached 100 GB, and CI ran around 25 million checkouts a day. Scion assumes clients are always online and keeps commits, merges, blame and history on a horizontally scalable server backed by Spanner. Changesets live in a write-ahead log with recursively computed derived data, and clients fetch content-addressed trees and blobs through tiered caches. The result is a footprint 200x smaller than the old git mirrors, checkouts measured in seconds instead of minutes, and a 25% CI CPU saving, built by a team of seven in five months with heavy Claude assistance.

  • WebKit on GitHub!

    WebKit easyNovice

    WebKit froze its Subversion tree on June 23rd and moved source control to git hosted on GitHub, citing git's distributed collaboration model, its author/committer model, cheap branch and revert operations, and the fact that most contributors already worked from git-svn mirrors. GitHub was chosen for its developer community and an API that made pre- and post-commit automation easy to build. Because git hashes are unordered, which complicates bisection under WebKit's zero-tolerance performance regression policy, the project uses "commit identifiers": the ancestor count on main (git rev-list --count) plus a branch-relative count for branches. These identifiers are supported by the git-webkit script and the commits.webkit.org translation service.

  • Turn one giant AI-generated pull request to a reviewable stack

    GitHub Engineering mediumAdept

    Stacked pull requests split a large, agent-generated feature diff into a chain of small, dependency-ordered PRs that are each scoped to one concern. A worked example adds product search to a shopping assistant as four layers: catalog data, search API, chat wiring, and grounded UI. Each layer is built by a scoped custom agent and reviewed by a different owner using the gh-stack CLI (init, add, push, submit, rebase, sync). The recommended review flow is to read top-down for context and review bottom-up. Fixes to a lower layer are propagated with gh stack sync. Prefer local gh stack rebase over the web Rebase button, because the server-side rebase resets the committer and produces unsigned commits that can break branch protection.

  • Merging two GitHub repositories without losing commit history

    Mozilla Hacks mediumAdept

    MDN merged small example repositories into a larger parent repo while keeping full commit history, using only plain git commands. First, inside the source repo, all files move into a subdirectory matching the target layout (using zsh extendedglob negation like `mv ^(sw-test|service-worker)`, with hidden files moved separately so `.git` stays put). That change is merged, then the source is added as a remote in the target and merged with `git merge --allow-unrelated-histories`, resolving add/add conflicts such as README.md.

The quest for software engineering knowledge.

Look:
Layout: