$ git merge -s recursive -X theirs branchname
めも
ファイルが消されていて下記のメッセージが出るケースがあった。
CONFLICT (modify/delete): deleted in and modified in HEAD. Version HEAD of left in tree.
該当のファイルをgit rm後、上記mergeで解決
上記でも既存ブランチとの差が出るケースがあった。
Y氏からの別案
new:ソース old:置き換え対象 $ git checkout -b old-new new $ git merge -s ours old $ git checkout old $ git merge old-new
めも
$ cat ~/.gitconfig [alias] branch-replace = !(git checkout -b $1-$2 $2 && git merge --no-edit -s ours $1 && git checkout $1 && git merge $1-$2) && echo # $1:old $2:new $ GIT_TRACE=1 git branch-replace obsolete dev-old