Subject: Re: cherry-pick applies some other changes than the specified one?

From: Johannes Sixt <[email-masked]>
Date: Mon, 21 Mar 2011 17:41:17 +0100

Am 3/21/2011 17:09, schrieb Junio C Hamano:
> Piotr Krukowiecki <[email-masked]> writes:
>> But when I take a different approach, and in addition to this:
>>
>>> If I edit the file and remove the "<<<< HEAD" marked and code
>>> between "===" and ">>>"  then
>>
>> I also manually add the "+line" which is the change done in the cherry-picked
>> commit, git diff shows a lot of other changes in unrelated lines
>> (which lie close
>> but still were not modified by the patch, nor were shown previously by
>> git diff).
>>
>> This is very weird.
> 
> Sorry, I have no idea what you are talking about.

Assuming you did not 'git add' the file yet, you are looking at the
"condensed combined diff" after manually resolving the conflict by doing
the "+line" manually that the cherry-pick should have brought in. Of
course, a lot of context is visible here if both sides have diverged
considerably in this area.

I.e. the diff will look something like

 +line from HEAD
 +line from HEAD
+ line from cherry-picked
 +line from HEAD
...

Notice the double columns before the content lines. This sort of diff
extens above and below the conflicting section until there is a "gap" of 3
lines that changed neither on the HEAD side nor on the cherry-picked side
since the merge base.

-- Hannes