Interview Prep/Git & GitHub/Branching and Merging Workflows

During a merge you want your version of one file wholesale and theirs for another. How?

IntermediateScenarioBranching and Merging Workflows
Answer

Situation read → Per-file decisions during a conflicted merge.

What I'd do →

  1. Take our side for the file: git checkout --ours config/prod.yaml.
  2. Take their side for another: git checkout --theirs docs/guide.md.
  3. Stage both, then finish the merge.
git checkout --ours config/prod.yaml
git checkout --theirs docs/guide.md
git add config/prod.yaml docs/guide.md
git merge --continue

Why → In a merge, "ours" is the branch you are on and "theirs" is the one being merged. In a rebase these are swapped.

Interview tip → Distinguish this from -X theirs, which only auto-wins on conflicting hunks while still merging the non-conflicting ones.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching and Merging Workflows