Cherry picking with git with conflict

I have two branches Z with some changed and M with some conflicting changes. I would like to combine the first change to Z in M. When I try to see what changes still exist. (There are actually a few more changes, but this already shows the problem)

$ git checkout M $ git cherry MZ + 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 

I set the conflict here

 • (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 MZ + 153c2f840f2192382be1fc435ceb069f0814d7ff + 4a7979d5dd526245b51769db21acf4c286825036 

So, after I made the change, he still thinks that no changes were chosen by the cherry. I expected:

 - 153c2f840f2192382be1fc435ceb069f0814d7ff + 4a7979d5dd526245b51769db21acf4c286825036 

How do I know in a week that I have already combined 153c2f? How can I make a cherry pick so that he knows about this merger?

+7
source share
1 answer

How do you know?

Not using git cherry , because it only recognizes commits that have the same git patch-id ( see the man page ), that is, not those where you had to solve non-trivial conflicts.

So, you will need to find out by looking at the commit message.

How will future mergers learn about the cherry peak?

Since you resolved the conflict when you applied the changes made in cherry, this obligation should merge trivially when you merge the entire branch in the future.

If you are really concerned about git remembering how you resolved the conflict, you can enable git rerere :

 git config --global rerere.enabled true 
+3
source

All Articles