LoginSignup
8
8

More than 5 years have passed since last update.

マージコミットのrevertとcherry-pick

Posted at

以下のようなコミットグラフを例にして説明します。
A->Dの順に新しいコミットとし、便宜上、DのコミットIDを"abcdefg"とします。

D
| \
C |
| B
|/
A

# Bのブランチをrevertする場合
git revert -m 1 abcdefg

# Bのブランチをcherry-pickする場合
git cherry-pick -m 1 abcdefg

# Cのブランチをrevertする場合
git revert -m 2 abcdefg

# Cのブランチをcherry-pickする場合
git cherry-pick -m 2 abcdefg
8
8
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
8
8