Interview Prep/Git & GitHub/Branching and Merging Workflows

Before merging, you want to see exactly what the feature branch adds compared to `main`. Which commands?

BeginnerScenarioBranching and Merging Workflows
Answer

Situation read → Two questions: which commits, and which changes.

What I'd do →

  1. Commits only on the feature: git log --oneline main..feature.
  2. Net changes the feature introduces since it diverged: git diff main...feature (three dots).
  3. File list only: git diff --stat main...feature.

Why → Three dots compares the feature tip against the merge base, so you see only the feature's work. Two dots compares both tips and also shows whatever main gained meanwhile.

Interview tip → Explain the dot difference: it is a classic quick check.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching and Merging Workflows