Git Version Control, Branching Strategies & Code Reviews
Version pipeline code with clear branching, PRs, and reviews that catch data bugs before they ship.
In plain words
Define one reviewable data or code behavior. Next, change with migration and rollback in mind. Finally, inspect blast radius, then tag or deploy.
Think of it like…
Version control is a flight recorder plus an engineering review board: the log shows every change, but the review must still inspect the route and emergency landing plan.
Where you’ve seen it
A PR adds an additive column and model under a feature flag, runs ruff check, pytest, and dbt build --select state:modified+ --defer state:prod, then removes the old field only in a later release.
Words you’ll hear
- Git
- A content-addressed history tool; commits are snapshots with parents, not a backup policy by themselves.
- Branching
- A rule for integrating work-typically short-lived branches and trunk-based CI for fast-feedback data platforms.
- Code Review
- An explicit inspection of correctness, migration safety, observability, cost, and ownership before code reaches production.
- Operational boundary
- A green unit test does not catch a migration that truncates a production table, a pipeline DAG that loads twice, or a secret accidentally committed in history. Use short-lived branches or protected trunk, conventional PRs, migration-specific review checklists, secret scanning, and CI that tests against representative schemas and sample partitions.
Visual diagram
Theory & deep dive
Git: the working mechanism
Git records immutable snapshots and reviewable diffs; a branching strategy should make small, reversible changes easy while CI proves schema, data, and code compatibility.
Define one reviewable data or code behavior. Change with migration and rollback in mind, then run tests, linters, and sample data checks; this exposes the state governed by Code Review.
A PR adds an additive column and model under a feature flag, runs ruff check, pytest, and dbt build --select state:modified+ --defer state:prod, then removes the old field only in a later release.
Git Version Control, Branching Strategies & Code Reviews: failure mode and production response
A green unit test does not catch a migration that truncates a production table, a pipeline DAG that loads twice, or a secret accidentally committed in history.
Use short-lived branches or protected trunk, conventional PRs, migration-specific review checklists, secret scanning, and CI that tests against representative schemas and sample partitions. Track Review size as "small enough to inspect the schema and data behavior", and make Rollback visible to the dataset owner.
How it works, step by step
Step 1 of 41. Slice
Define one reviewable data or code behavior. Git records immutable snapshots and reviewable diffs; a branching strategy should make small, reversible changes easy while CI proves schema, data, and code compatibility.
- Review size
- small enough to inspect the schema and data behavior
- Branching
- A rule for integrating work-typically short-lived branches and trunk-based CI for fast-feedback data platforms.
When to use it & trade-offs
What it is
Git records immutable snapshots and reviewable diffs; a branching strategy should make small, reversible changes easy while CI proves schema, data, and code compatibility. A PR adds an additive column and model under a feature flag, runs ruff check, pytest, and dbt build --select state:modified+ --defer state:prod, then removes the old field only in a later release.
Why it matters: A green unit test does not catch a migration that truncates a production table, a pipeline DAG that loads twice, or a secret accidentally committed in history. Use short-lived branches or protected trunk, conventional PRs, migration-specific review checklists, secret scanning, and CI that tests against representative schemas and sample partitions.
When to reach for it
- Version pipeline code with clear branching, PRs, and reviews that catch data bugs before they ship.
- Choose Git because it provides this capability: A content-addressed history tool; commits are snapshots with parents, not a backup policy by themselves.
- Keep evidence for Review size at "small enough to inspect the schema and data behavior" so the last production stage-Review and merge - inspect blast radius, then tag or deploy-remains testable.
When to avoid or be careful
- A green unit test does not catch a migration that truncates a production table, a pipeline DAG that loads twice, or a secret accidentally committed in history.
- Do not conflate Branching with Git. The second concept contributes different behavior: A rule for integrating work-typically short-lived branches and trunk-based CI for fast-feedback data platforms.
- Release only after this guardrail is in place: Use short-lived branches or protected trunk, conventional PRs, migration-specific review checklists, secret scanning, and CI that tests against representative schemas and sample partitions.
Git / Branching / Code Review - roles, limits, and operating cost
Strengths: A content-addressed history tool; commits are snapshots with parents, not a backup policy by themselves. Git records immutable snapshots and reviewable diffs.
Watch out: A green unit test does not catch a migration that truncates a production table, a pipeline DAG that loads twice, or a secret accidentally committed in history.
Strengths: A rule for integrating work-typically short-lived branches and trunk-based CI for fast-feedback data platforms. In this workflow it supports: Prove - run tests, linters, and sample data checks.
Watch out: The operating cost is real: one known commit or migration version can restore service.
Strengths: An explicit inspection of correctness, migration safety, observability, cost, and ownership before code reaches production. Its output can be checked with Migration window.
Watch out: Operating guardrail: Use short-lived branches or protected trunk, conventional PRs, migration-specific review checklists, secret scanning, and CI that tests against representative schemas and sample partitions.
Interview signals & numbers to know
When this topic comes up
- “Where is the failure boundary for Git, and how would Review size reveal it?”
- “Why is Branching distinct from this behavior: an explicit inspection of correctness, migration safety, observability, cost, and ownership before code reaches production?”
- Production clue: A green unit test does not catch a migration that truncates a production table, a pipeline DAG that loads twice, or a secret accidentally committed in history.
- Design probe: Use short-lived branches or protected trunk, conventional PRs, migration-specific review checklists, secret scanning, and CI that tests against representative schemas and sample partitions.
Benchmarks & rules of thumb
- Review size
- small enough to inspect the schema and data behavior
- Rollback
- one known commit or migration version can restore service
- Migration window
- older and newer readers both work during the rollout
Common mistakes & follow-ups
Common interview mistakes
- A green unit test does not catch a migration that truncates a production table, a pipeline DAG that loads twice, or a secret accidentally committed in history.
- Reporting success from a job exit code without checking Review size and Rollback.
- Treating this example as complete without replay, rollback, or access boundaries: A PR adds an additive column and model under a feature flag, runs
ruff check,pytest, anddbt build --select state:modified+ --defer state:prod, then removes the old field only in a later release.
Likely interviewer follow-ups
- How would you prove this contract instead of only checking that the command ran: A content-addressed history tool; commits are snapshots with parents, not a backup policy by themselves.
- What does the recovery plan do when this occurs? A green unit test does not catch a migration that truncates a production table, a pipeline DAG that loads twice, or a secret accidentally committed in history.
- When is Git insufficient for Rollback, and what does adding Branching cost in Review size?
Knowledge check
Put it into practice
Practice related interview Q&A
Apply Git Version Control, Branching Strategies & Code Reviews with data engineer interview Q&A and hands-on practice.