Sapling is a scalable, user-friendly, and open-source source control system that powers Meta’s monorepo. As discussed at the GitMerge 2024 conference session on branching, designing and imple…
Overview
The article discusses the implementation of branching workflows in Meta's Sapling monorepo, focusing on the challenges of scalability and developer experience. It introduces directory branching as a solution to manage multiple versions of code effectively while maintaining a linear commit graph.
What You'll Learn
How to implement directory branching in a monorepo using Sapling
Why directory branching improves scalability and developer experience in large codebases
When to use full-repo branching versus directory branching in a monorepo
Prerequisites & Requirements
- Understanding of source control systems and branching strategies
- Familiarity with Sapling source control commands(optional)
Key Questions Answered
What are the challenges of using full-repo branching in a monorepo?
How does directory branching work in Sapling?
What feedback has been received from developers at Meta regarding directory branching?
When should directory branching be used instead of traditional branching?
Technologies & Tools
Key Actionable Insights
1Implement directory branching to manage multiple versions of code without the drawbacks of full-repo branching.This approach allows teams to maintain a linear commit history while enabling merging workflows at the directory level, enhancing both scalability and developer experience.
2Utilize the sl subtree command suite for effective directory management in Sapling.These commands facilitate operations like copying, merging, and cherry-picking changes, which are essential for maintaining code integrity across different versions.
3Consider using directory branching when CI costs are high or when significant changes could disrupt production.This strategy allows teams to isolate development efforts from production, providing more control over deployment timelines.