idea git cherry-pick

什么是git cherry-pick?

把A分支上的一些commit, git push到另一個分支B.

用idea進行git cherry-pick

下面將分支annotation-processor上的一些commit, git push到另一個分支master.

1 首先, 切換到想要git push的分支master

2 把annotation-processor分支上的一些commit進行git cherry-pick

調出git history, 選擇需要git cherry-pick的分支annotation-processor;

使用ShfitCtrl選擇多個commit, 然后右鍵, 接着點擊cherry-pick.

3 把剛才git cherry-pick的commit, git push到master分支

使用Ctrl+Shift+K快捷鍵或者git push 剛才git cherry-pick的commit.

由於我的idea設置是cherry-pick之后自動commit, 所以我直接git push就行了.

如果沒有上面的這個設置, 先commit, 再push就行了.

這樣就做到了將分支annotation-processor上的一些commit, git push到另一個分支master.