LoginSignup
65
62

More than 5 years have passed since last update.

他のブランチへ特定のコミットをマージする

Last updated at Posted at 2015-05-11

cherry-pickを使用すると、他のブランチをマージするのではなく、
特定のコミットだけをマージする事が出来る。

$ git cherry-pick
usage: git cherry-pick [options] <commit-ish>...
   or: git cherry-pick <subcommand>

    --quit                end revert or cherry-pick sequence
    --continue            resume revert or cherry-pick sequence
    --abort               cancel revert or cherry-pick sequence
    -n, --no-commit       don't automatically commit
    -e, --edit            edit the commit message
    -s, --signoff         add Signed-off-by:
    -m, --mainline <n>    parent number
    --rerere-autoupdate   update the index with reused conflict resolution if possible
    --strategy <strategy>
                          merge strategy
    -X, --strategy-option <option>
                          option for merge strategy
    -x                    append commit name
    --ff                  allow fast-forward
    --allow-empty         preserve initially empty commits
    --allow-empty-message
                          allow commits with empty messages
    --keep-redundant-commits
                          keep redundant, empty commits

例えば、masterブランチに特定のコミットをマージしたい場合はこんな感じ。

$ git checkout master
$ git cherry-pick 965e5f980e4d7ee848c2163fc75def15d88d3524 
65
62
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
65
62