用 git cherry-pick 處理專案 push/pull request

A-B-C-D-E-F              (master)
………………….\
……………………G          (topic)

1: 先切出一個另外的branch (ex: topic)
2: 在這個branch (ex: topic)上做修改與撰寫程式碼
3: 在這個branch (ex: topic)上作: git add / git commit
4: 切回master 作: git cherry-pick xxxxxxxxxx / git push

 

 

 

git cherry-pick 321d76f # 只合併特定其中一個 commit。如果要合併多個,可以加上 -n 指令就不會先幫你 commit,這樣可以多 pick幾個要合併的 commit,最後再 git commit 即可。

發表迴響