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 →
- Commits only on the feature:
git log --oneline main..feature. - Net changes the feature introduces since it diverged:
git diff main...feature(three dots). - 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.
More on Branching and Merging Workflows
You run `git pull` and Git stops with a merge conflict in `app.py`. What do you do?BeginnerYour feature branch is three weeks old and `main` has moved a lot. Merge `main` in, or rebase onto it?IntermediateThe team argues about fast-forward merges versus merge commits on `main`. How do you settle it?BeginnerA teammate branched from the wrong base, and their PR shows 40 unrelated commits. How do you fix it?IntermediateHalfway through a merge you realise you pulled the wrong branch. How do you back out?BeginnerYou keep resolving the same conflicts again and again while rebasing a long-lived branch. How do you stop?Intermediate