If there’s been a large-scale renaming of files in
master and you attempt to rebase
your pull-request branch, the resulting conflicts can be tricky to resolve.
You’ll see lots of conflicts of form:
CONFLICT (modify/delete): $FILEPATH deleted in HEAD and modified in $SHA... $COMMIT_MSG
One resolution is to manually apply the changes in
$SHA to the new filepaths
but this is manual and error-prone.
Better is to use
git diff to generate patch files and apply these with
Run this for each filepath modified in your PR but deleted in
$ git show REBASE_HEAD $OLD_FILEPATH | patch $NEW_FILEPATH
REBASE_HEAD is a useful pseudo-ref for the conflicting commit from the
If you’re interested, I’ve written previously about resolving Git conflicts during a Git rebase.