Git Workflow
Mastering Stacked Diffs and Git Workflow
If you have ever felt paralyzed by a massive feature branch that has fallen weeks behind main, you know the pain of the traditional GitHub Flow. There is a better way: Stacked Diffs.
What is a Stacked Diff?
Instead of one giant branch for a feature, you break your work into a chain (or stack) of small, dependent branches.
main
└─ feature-part-1 (API changes)
└─ feature-part-2 (UI components)
└─ feature-part-3 (Integration)
You submit a Pull Request for feature-part-1. While it is being reviewed, you continue working on feature-part-2 based on feature-part-1. You do not stop. You do not context switch.
Why Stack?
- Faster Reviews: Reviewers only look at small, logical chunks of code.
- Unblocked Development: You never have to wait for a review to continue coding.
- Easy Reverts: If Part 2 has a bug, you can revert just that part without killing the whole feature.
Tooling Matters
Managing stacks manually with standard Git commands can be painful (git rebase --interactive hell). Tools like Graphite (and increasingly, native Git features) make this workflow seamless.
At MatterAI, we use stacked diffs for everything. It allows our small team to ship with the velocity of a team 10x our size.
Best Practices
- Keep stacks usually under 4-5 deep. Any deeper and managing dependencies becomes tricky.
- Merge from the bottom up. Once the bottom PR is approved and merged, rebase the rest of the stack on top of
main. - Communicate with reviewers. Let them know it is a stack so they understand the context of the changes.
Share this Guide:
More Guides
API Gateway Showdown: Kong vs Ambassador vs AWS API Gateway for Microservices
Compare Kong, Ambassador, and AWS API Gateway across architecture, performance, security, and cost to choose the right gateway for your microservices.
12 min readGitHub Actions vs GitLab CI vs Jenkins: The Ultimate CI/CD Platform Comparison for 2026
Compare GitHub Actions, GitLab CI, and Jenkins across architecture, scalability, cost, and security to choose the best CI/CD platform for your team in 2026.
7 min readKafka vs RabbitMQ vs EventBridge: Complete Messaging Backbone Comparison
Compare Apache Kafka, RabbitMQ, and AWS EventBridge across throughput, latency, delivery guarantees, and operational complexity to choose the right event-driven architecture for your use case.
4 min readChaos Engineering: A Practical Guide to Failure Injection and System Resilience
Learn how to implement chaos engineering using the scientific method: define steady state, form hypotheses, inject failures, and verify system resilience. This practical guide covers application and infrastructure-level failure injection patterns with code examples.
4 min readScaling PostgreSQL for High-Traffic: Read Replicas, Sharding, and Connection Pooling Strategies
Master PostgreSQL horizontal scaling with read replicas, sharding with Citus, and connection pooling. Learn practical implementation strategies to handle high-traffic workloads beyond single-server limits.
4 min readContinue Reading
API Gateway Showdown: Kong vs Ambassador vs AWS API Gateway for Microservices
Compare Kong, Ambassador, and AWS API Gateway across architecture, performance, security, and cost to choose the right gateway for your microservices.
12 min readGitHub Actions vs GitLab CI vs Jenkins: The Ultimate CI/CD Platform Comparison for 2026
Compare GitHub Actions, GitLab CI, and Jenkins across architecture, scalability, cost, and security to choose the best CI/CD platform for your team in 2026.
7 min readKafka vs RabbitMQ vs EventBridge: Complete Messaging Backbone Comparison
Compare Apache Kafka, RabbitMQ, and AWS EventBridge across throughput, latency, delivery guarantees, and operational complexity to choose the right event-driven architecture for your use case.
4 min read