うおおおmasterに取り込むときに発生するのはやめろー!心臓に悪い!
爆発した
コンテンツの修正で、feature/modify_images_20160805などというブランチで作業していた所、pushしてgitlabからmerge rewuest出したら「コンフリクトしてだめなんでコマンドラインで解決して?」と言われるなどしたので。
[example@localhost example-temp]$ git push origin master To git@git.example.co.jp:example/example.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@git.example.co.jp:example/example.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details. [example@localhost example-temp]$ git pull warning: Cannot merge binary files: img/img_main.png (HEAD vs. 114514.......................) Auto-merging img/img_main.png CONFLICT (content): Merge conflict in img/img_main.png Automatic merge failed; fix conflicts and then commit the result.
うおおおおおお?!
どうする
gitlabの提示した解決方法が何も役に立たなくてあーん?みたいになったので、以下のようにcheckout --theirsして解決しました。
[example@localhost example-temp]$ git checkout --theirs img/img_main.png [example@localhost example-temp]$ git add img/img_main.png [example@localhost example-temp]$ git commit -m "conflictの解消" [example@localhost example-temp]$ git push origin master
--theirsだとmasterに元々存在するファイルになるようです。 とりあえずこれで解消できたのでよかった……。 ダメな場合は、reset --hardとかして過去ま戻るしかないかも。