Interview Prep/Git & GitHub/Branching and Merging Workflows

One developer renamed `utils.py` to `helpers.py` while another edited `utils.py`. Will merge handle it?

IntermediateScenarioBranching and Merging Workflows
Answer

Situation read → Git does not store renames; it detects them by similarity when merging.

What I'd do →

  1. Merge normally. With the default ort strategy, rename detection usually applies the edit to helpers.py.
  2. Check: git status and git diff --name-status -M main...feature.
  3. If similarity is too low (heavily edited file), you get a "rename/delete" conflict. Resolve by hand and keep the new name.
  4. Tune detection if needed: git merge -X find-renames=40%.

Why → Rename detection is content-similarity based, default threshold 50%.

Interview tip → Advise doing renames in their own commit, with no content edits, so Git can track them.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching and Merging Workflows