5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

複数のマージをまとめてrevertする

Posted at

参考URL

mergeコミットをrevertする
git revert で複数コミットを打ち消す

結論

git revert (複数コミットを取消)

git rebase -i (取消コミットを統合)

解説

まず取消たいブランチをチェックアウトする

revert

mergeコミットをrevertするを見ながら引数に複数のコミットを並べて複数のマージコミットを取消す
[commit…]はマージコミットのハッシュ値

% git revert -m 1 --no-edit [commit]…

rebase

revert で複数の取消コミットが出来るので git revert で複数コミットを打ち消す を見ながら rebase -i で統合

% git rebase -i HEAD~2

例えば2コミットをrevertしたとすると↑こんな感じ

5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?