2013-04-17 37 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