Help us understand the problem. What is going on with this article?

merge commitをcherry-pickする

More than 5 years have passed since last update.

背景

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も同じみたい

takc923
よろしくお願いします。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした