git cherry-pick改写提交
生活随笔
收集整理的這篇文章主要介紹了
git cherry-pick改写提交
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
教程3 改寫提交!
4. cherry-pick
為了節(jié)省時(shí)間,這個(gè)教程使用現(xiàn)有的歷史記錄作為本地?cái)?shù)據(jù)庫。
從這里下載
我們進(jìn)入stepup-tutorial/tutorial4目錄。本地端歷史記錄的狀態(tài)如下圖顯示。僅把在其他分支執(zhí)行的「添加commit的講解」的修改導(dǎo)入到master分支。
把修改移動(dòng)到master分支后,用cherry-pick 取出「添加commit的講解」提交,然后將其添加到master。(文檔里的提交"99daed2"和下載到數(shù)據(jù)庫里的提交有可能不相同。在下載的數(shù)據(jù)庫里執(zhí)行g(shù)it log,確認(rèn)是正確的提交之后再使用。)
$ git checkout master Switched to branch 'master' $ git cherry-pick 99daed2 error: could not apply 99daed2... commit hint: after resolving the conflicts, mark the corrected paths hint: with 'git add <paths>' or 'git rm <paths>' hint: and commit the result with 'git commit'如果發(fā)生沖突,就打開sample.txt,修改沖突的部分之后再提交。
$ git add sample.txt $ git commit總結(jié)
以上是生活随笔為你收集整理的git cherry-pick改写提交的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: git rebase教程
- 下一篇: git commit --amend