> For the complete documentation index, see [llms.txt](https://jen-hsuan-hsieh.gitbook.io/debugging-tools-experience/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jen-hsuan-hsieh.gitbook.io/debugging-tools-experience/chapter4gong-ju/chapter1/212cherry-pick.md).

# 4.1.3.cherry-pick

* cherry-pick並不會更改容器內現存的歷史紀錄, 而是新增歷史紀錄

## 將其他分支的commit合併到目前的分支

* 假設目前有兩個分支, master與dev
* 預期結果是將dev的head加到master ![](https://github.com/jenhsuan/debugging-tools-experience/tree/91ad7a157f155ea77065c5600800bb4627bd1ae2/assets/99.jpg)
* 1.git checkout dev
  * 切換到dev&#x20;
* 2.git log
  * 查看dev所有的commit

    ![](https://github.com/jenhsuan/debugging-tools-experience/tree/91ad7a157f155ea77065c5600800bb4627bd1ae2/assets/6.jpg)
* 3.git checkout master
  * 切換到master (要被增加commit的分支)
* 4.git cherry-pick (commit)
  * 將dev的head加到master

    ![](https://github.com/jenhsuan/debugging-tools-experience/tree/91ad7a157f155ea77065c5600800bb4627bd1ae2/assets/7.jpg)
* 5.git log
  * 查看master所有的commit

    ![](https://github.com/jenhsuan/debugging-tools-experience/tree/91ad7a157f155ea77065c5600800bb4627bd1ae2/assets/8.jpg)

## 處理衝突
