Interview's MateData Engineer
Interview's Mate

Data Engineer

SQL · Spark · Lakehouse · Streaming

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Engineer topics
Lesson 5/ 160
01. Data Engineering Foundations, Python & Linux

Git Version Control, Branching Strategies & Code Reviews

Version pipeline code with clear branching, PRs, and reviews that catch data bugs before they ship.

BeginnerGit · Branching · Code Review3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

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

Loading interactive 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.

Git Version Control, Branching Strategies & Code Reviews in one concrete design

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.

Key takeaway: Git records immutable snapshots and reviewable diffs

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.

Key takeaway: 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.

How it works, step by step

Step 1 of 4
Git

1. 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.

define one reviewable data or code behavior
Key numbers at this step
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

Git
Best for: A content-addressed history tool; commits are snapshots with parents, not a backup policy by themselves.

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.

Branching
Best for: A rule for integrating work-typically short-lived branches and trunk-based CI for fast-feedback data platforms.

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.

Code Review
Best for: An explicit inspection of correctness, migration safety, observability, cost, and ownership before code reaches production.

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, and dbt 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?
Interview tip: Lead with the data path and failure boundary: Git records immutable snapshots and reviewable diffs; a branching strategy should make small, reversible changes easy while CI proves schema, data, and code compatibility. Then make the answer operational: 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.

Knowledge check

Loading quiz

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.

Open Data Engineer Q&A →Machine Learning Q&A
Previous topic
Cron Jobs, File Permissions, SSH & Process Management
Next topic
Python Fundamentals for Data Pipelines (Data Structures, Iterators, Generators)