A way to solve this in a non-interactive way:
# Optional but helpful: remember conflict resolutions
git config rerere.enabled true
git config rerere.autoupdate true
git config rerere.autoreuse true
# don't auto-open editor on merges
export GIT_MERGE_AUTOEDIT=no
# make any commit/editor step a no-op
export GIT_EDITOR=:
# Start the rebase resolving all *content* conflicts in favour of the feature branch.
if ! git rebase -X theirs <TARGET BRANCH>; then
# Rebase stopped on a conflict; loop until done
while true; do
# Keep the feature-commit side for all conflicted paths
git checkout --theirs .
git add -A
# Continue; returns 0 when the entire rebase finishes,
# non-zero when it hits the next conflict
if git rebase --continue; then
break
fi
done
fi
# Push your rebase
git pushYou can accept all content changes from your branch. Which, during a rebase, is "theirs" — not "ours".
git checkout <TARGET BRANCH>
git pull
git checkout <YOUR FEATURE BRANCH>
git rebase -X theirs <TARGET BRANCH>The problem is, the deletions and renamings are not processed automatically, as they are not content conflicts. So you do need to do the following manual steps a number of times every time the rebase stops with a message like "CONFLICT (modify/delete): <...> deleted in HEAD and modified in <...>. Version <...> of <...> left in tree.":
git checkout --theirs .
git add -A
git rebase --continue
:wqTo avoid this manual work, use the solution from above.
Note: Consider doing this on a throwaway branch first: git branch backup/FEATURE_BRANCH && git checkout -b tmp/autorebase.