0
0

More than 1 year has passed since last update.

ブランチから別のブランチへコミットをコピーしたいとき

Last updated at Posted at 2022-04-20

今日使う機会があったのでメモしておきます。

基本のコマンド

git cherry-pick [コミットID]

使用例

branchAのコミットをbranchBにコピーしたい場合

# コピー元のブランチに移動
$ git checkout branchA

# コミットログを確認
$ git log --oneline
6c49ad2 Bootstrapをインストール  # ←このコミットをコピーしたい!
a8d8544 Laravel UIをインストール

# コピー先のブランチに移動
$ git checkout branchB

# コミットIDを指定して実行
$ git cherry-pick 6c49ad2
0
0
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
0
0