Workflows
Sync Before Review
Sync your branch with main before opening review so reviewers see current, focused diffs instead of stale base noise.
- Teams turning commands into repeatable routines
- Readers who need sequencing, branch, and sync discipline
- Basic understanding of fetch, pull, push, and branches
- A sense of how and why branches diverge
- Copying a workflow without checking branch state
- Choosing the wrong integration path on shared branches
Citations & Further Reading
- Git Branching Rebasing [Book]
- Git fetch [Official]
- Git pull [Official]
What you will learn
- Understand the core purpose of Sync Before Review
- Master the basic usage and common options of Sync Before Review
- Sync your branch with main before opening review so reviewers see current, focused diffs instead of stale base noise.
- Understand key concepts: Why this step matters
- Know when to use this feature and when to avoid it
When a branch drifts too far from main, review gets noisier: already-resolved upstream changes reappear, stale-base conflicts distort the context, and the real scope of the change becomes harder to see.
Syncing before review is essentially reviewer empathy expressed as branch hygiene.
Start with a problem
Your team is collaborating on a project, branches are growing, merges are becoming more frequent — but there's no stable collaboration rhythm. Everyone syncs code their own way, and conflicts are piling up.
Why this step matters
Review cost is not only about reading code. It is also about understanding which base the code is being compared against.
If the branch drifted for too long, reviewers are forced to process:
- outdated differences
- sync conflicts you could have resolved earlier
- extra history noise unrelated to the actual task
That dilutes attention away from the real change.
Recommended flow
git fetch origin
git rebase origin/main
git diff --stat origin/main...
If your team prefers not to rewrite branch history:
git fetch origin
git merge origin/main
The important part is not mandatory rebase. It is completing both the main-line update and the post-sync diff review.
Why this workflow is safer
It fixes the order:
- update your view of main
- integrate main into your branch
- re-check whether the diff still matches the intended review scope
That sequence turns syncing from an afterthought into review preparation.
What to confirm before review
- your branch includes the latest mainline state
- the diff still matches the intended scope
- the latest commits are clean enough for reviewers to follow
- if the branch is shared, the chosen integration method matches team expectations
Useful commands:
git branch -vv
git diff --stat origin/main...
git log --oneline --decorate -8
What this saves reviewers from
- irrelevant differences
- stale-base conflict context
- extra effort just to recover the real scope of the change
- uncertainty about whether the branch is actually review-ready
When pre-review sync reveals a deeper problem
Sometimes the sync step exposes something more fundamental:
- the branch is too large
- the topic boundary is too broad
- the commit structure is too noisy
In those cases, do not stop at syncing. Go back and clean the branch before asking for serious review.
Many people sync and immediately open review, assuming they only “brought main in.” But integration can change the diff structure in important ways. If you do not re-check, you may send new noise straight into review.
Common mistakes
Waiting for reviewers to point out that the base is stale
That offloads preventable cleanup onto reviewers.
Syncing main but never re-checking the final diff
The integration step may have changed more than expected.
Treating pre-review sync as optional cleanup
It is usually part of the review-quality bar itself.
- Can I explain the current relationship between this branch and main?
- After syncing, does the diff still represent the change I want reviewed?
- Will reviewers spend their time on business logic, or on history noise I should have cleaned first?
Good follow-up reads
Try it yourself
- Practice the sync-before-review command in a test repository and observe state changes before and after
- Experiment with different options and compare the output differences
- Simulate a real scenario where you would need to use this, and walk through the full process
Further reading
Keep going on the same topic: