Interview Prep/Git & GitHub/Branching and Merging Workflows

You run `git pull` and Git stops with a merge conflict in `app.py`. What do you do?

BeginnerScenarioBranching and Merging Workflows
Answer

Situation read → Both you and a teammate changed the same lines. Git paused the merge and marked the file with conflict markers.

What I'd do →

  1. git status to see the "both modified" files.
  2. Open the file, find <<<<<<<, =======, >>>>>>>, and decide what the final code should be. Talk to the author if the intent is unclear.
  3. Remove the markers, then git add app.py.
  4. Run the tests, then git commit (or git merge --continue).
git status
git add app.py
git merge --continue

Why → Git only knows both sides changed the same hunk, not which one is right. A human has to pick, and tests prove the result.

Interview tip → Say you run tests before finishing the merge, not after.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching and Merging Workflows