2013-04-17 61 views
7

我有兩個分支Z與一些變化和M與一些衝突的變化。我想將Z上的第一次更改合併爲M.當我試圖查看哪些更改仍然存在時。 (其實有幾個改變,但是這已經說明問題了)與git衝突採摘櫻桃

$ git checkout M 
$ git cherry M Z 
+ 153c2f840f2192382be1fc435ceb069f0814d7ff 
+ 4a7979d5dd526245b51769db21acf4c286825036 

$ git cherry-pick 153c2f840f2192382be1fc435ceb069f0814d7ff 
error: could not apply 153c2f8... add Z 
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' 
• (M|CHERRY-PICKING) $ git st 
# On branch M 
# Unmerged paths: 
# (use "git add/rm <file>..." as appropriate to mark resolution) 
# 
# both modified:  README.txt 
# 
no changes added to commit (use "git add" and/or "git commit -a") 
• (M|CHERRY-PICKING) $ vim README.txt 

我固定的衝突在這裏

• (M|CHERRY-PICKING) $ git add README.txt 
• (M|CHERRY-PICKING) $ git ci -m'cherry picked' 
    [M dc5de35] cherry picked 
    1 file changed, 1 insertion(+), 1 deletion(-) 
• (M) $ git cherry M Z 
+ 153c2f840f2192382be1fc435ceb069f0814d7ff 
+ 4a7979d5dd526245b51769db21acf4c286825036 

所以我提交它仍然認爲,無論變化是cherry-變更後拿起 我期待:

- 153c2f840f2192382be1fc435ceb069f0814d7ff 
+ 4a7979d5dd526245b51769db21acf4c286825036 

我怎麼從現在起,我已經合併153c2f知道一個星期? 我該如何做櫻桃採摘的方式,它會知道這種合併?

回答

3

你會怎麼知道?

無法使用git cherry,因爲它只能識別具有相同git patch-idsee man page)款,即不是那些你不得不解決非平凡的衝突。

所以你必須通過查看提交消息來知道。

未來將如何合併櫻桃採摘?

由於您在應用櫻桃選擇的更改時解決了衝突,因此在將來合併整個分支時,該提交應該平凡地合併。

如果你真的關心的git記住你如何解決衝突,你可以使git rerere

git config --global rerere.enabled true