git revert したブランチを再度マージする方法
先日あやまって、topic branch を master にマージしてしまったので、 マージコミットを revert しました。のちほど再度 merge しようとしたのですがうまくマージされませんでした。この場合は、git revert したときにできた revert commit に対して git revert するようです。
$ git marge hoge # あやまって hoge branch をマージ ... $ git log # merge commit が作成される commit <merge-commit-hash> Merge: aaaa bbbb Author: Foo Baz <foo@baz.com> Date: Tue Sep 4 17:19:00 2018 +0900 Merge branch 'hoge' ... $ git revert -m 1 <merge-commit-hash> # この merge commit を revert ... $ git log # revert commit が作成され revert された commit <revert-commit-hash> Author: Foo Baz <foo@baz.com> Date: Tue Sep 4 17:29:00 2018 +0900 Revert "Merge branch 'hoge'" This reverts commit <merge-commit-hash>, reversing changes made to cccc. .... $ git revert <revert-commit-hash> # 再度マージするため revert commit を revert ... $ git log # revert commit の revert commit が生成され無事マージされた commit eeee Author: Foo Baz <foo@baz.com> Date: Tue Sep 4 17:39:00 2018 +0900 Revert "Revert "Merge branch 'hoge'"" This reverts commit <revert-commit-hash>. ...
参考