間違いだらけの備忘録

このページの内容は無保証でありこのページの内容によって直接、または間接に損害を受けられたとしても私は責任を取りません。

ベース変更時のブランチの内容での置き換え

$ 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で解決

参考
http://stackoverflow.com/questions/12809783/git-conflict-file-deleted-in-head-and-modified-in-revision

上記でも既存ブランチとの差が出るケースがあった。
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
このページにはhatena以外のサービスからのコンテンツが埋め込まれています。 hatenaによりGoogle AdSense 広告が埋め込まれています。