Re: merge result

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lynn Lin <lynn.xin.lin@xxxxxxxxx> writes:

>>>    1->2->3-4>5        Master
>>>        |
>>>        4->6->7          A
>>
>> A more accurate drawing would be
>>
>>    1->2->3-4>5        Master
>>        |
>>        4'->6->7          A
>>
>> and after merging, you'd get
>>
>>    1->2->3-4>5-->8  A, master
>>        |       /
>>        4'->6->7
>>
>> with 8 having both 4 and 4' as ancestors. There's nothing wrong with it.
>> Git cannot remove either 4 or 4' without rewritting history, and "git
>> merge" does not rewrite history.
> so confused here.If 4' is just next 4 commit,how can the diff work? for example
>
> 1->2->4->4'->6->...
>
>  diff 4 and 4' is a little confused,correct?

History is not linear. When you type "git log", you may think that 4 and
4' follow each other, but try "gitk" or "git log --oneline --graph" to
see a better view of history.

It's possible to have several times the same change applied to multiple
branches (e.g. when doing cherry-picking), but having twice the same
change in a row is not really possible.

Suppose your commit 4 removes the line "foobar". Then, commits 1, 2 and
3 have the line "foobar" (think of commits as snapshots in history, not
as diff. 3 is a snapshot, and when you run "git show 3", it shows you
the diff from 2 to 3). Commits 4 and 4' don't have it anymore, and then
obviously 5, 6, 7 don't have it either. At the time of merge, Git will
notice that neither of the merges to commit have the line "foobar" and
the result 8 won't have it either.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]