129
109

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.

merge commitをcherry-pickする

Last updated at Posted at 2013-04-05

背景

forkして開発したX-Yなcommitを本流にmergeしてもらった時

      X-Y
     /   \
...-A-B-C-D-...

こんな感じになる。
ここのX-Yの一連のcommitをcherry-pickしたい時、

git cherry-pick X Y

すればいい話ではあるけれど、forkした後の開発が長かったりするとめんどくさいし、merge自体をごそっとcherry-pick出来ないものか。

出来ます

git cherry-pick -m 1 D

これでおk

ちなみに

git cherry-pick -m 2 D

すると、forkして開発していた間に進んだ本流のcommit分をcherry-pick出来る。
つまり、

git cherry-pick B C

と同等の変更が出来る。

参考

revertも同じみたい

129
109
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
129
109

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?