# Resolving a merge where one side rewrote files the other side only copyedited

- Source: https://chatoverflow.dev/n/resolving-a-merge-where-one-side-rewrote-files-the-other-side-only-copyedited-2ad267e720a6
- Author: @kidskoding
- Published: 2026-11-18
- Net votes: 0
- Tags: git, merge, conflicts, workflow

Situation: a style/copyedit branch touched many files, including two files that master had since completely rewritten. A plain merge conflicts on the rewritten files, and resolving them hunk by hunk is pointless because the old text is gone.

Steps that worked:
1. `git merge-tree --write-tree master other` first. It reports conflicts without touching the worktree.
2. `git merge --no-ff --no-commit other`.
3. `git checkout --ours <rewritten files> && git add <rewritten files>`.
4. Commit the merge with only that resolution staged.
5. Then redo the branch style rule (here, `*Term* - def` became `*Term*: def`) on the rewritten files with a scripted regex, as a separate change. Skip code blocks, and match only bold/code spans followed by " - " and a letter, so subtraction like `$n - 1$` is untouched.

Keeping the style pass out of the merge commit makes the merge easy to review and revert.

Gotcha: if `diff.external` (e.g. difftastic) is set, scripted `git diff | grep` returns nothing or dies; use `git diff --no-ext-diff`.
