git cherry-pick

はじめに

最近、仕事でgit cherry-pickを使用する機会があった。

簡単なサンプルでgit cherry-pickについて見ていこう。

簡単なサンプル

gitフォルダのcherry-pick.py

C.U.R.I.O.S.I.T.Yを出力

Git管理

git init → git remote → git add → git commit → git push

リモート

https://github.com/ki-hi-ro/git/tree/master

新しいブランチを作成

コミットをプッシュ

c.h.a.o.s.m.y.t.hに変更

https://github.com/ki-hi-ro/git/commits/new/

元のブランチに戻る

ここで、cherry-pick

取り込みたいコミットのIDをコピーしておく。

https://github.com/ki-hi-ro/git/commit/51a52a70f5aad3f0595645ba421b78ca94621d57

git cherry-pick <コミットID>

これで別ブランチの特定コミットを取り込めた。

リモートにプッシュする。

https://github.com/ki-hi-ro/git/commits/master

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です