[ACCEPTED]-Evil merges in git?-merge
Because it's putting things in the code 8 that no one ever asked to be there. As 7 if you had this code:
$foo = bar;
$baz = qxx;
and this change:
$foo = bar;
$foo++;
$baz = qxx;
got 6 merged with this change:
$foo = bar;
$foo--;
$baz = qxx;
in a fashion that 5 somehow produced:
$foo = bar;
$foo++;
$foo--;
--$baz;
$baz = qxx;
Clearly, this is evil.
I 4 would guess that it's of enough concern 3 to be in man gitglossary
because the more involved your 2 merging algorithms are, the more likely 1 it is that they will produce such a thing.
In the words of Linus Torvalds himself (taken 4 from the git mailing list):
an "evil merge" is 3 something that makes changes that came from 2 neither side and aren't actually resolving 1 a conflict
I think it might be named 'evil merge' because 14 it is difficult corner case for "git blame" to 13 solve when annotating file (generating line-wise 12 history annotations).
Evil merge migh be 11 needed when you developed feature 'A' on 10 main branch, and feature 'B' on side branch, and 9 those features conflict in semantic (non-textual) way. An 8 example would be using the same name for 7 global variable, with different meanings 6 -- this requires renaming the variable for 5 one of features.
For evil merge "git show --cc
" has non-empty 4 compact combined diff (but I am not sure 3 if it is equivalence relation; the implication 2 might be in one direction only, i.e. "evil 1 merge" then non-empty "git diff-tree -p --cc
").
It is worth to mention that an "evil 5 change" from an "evil merge" can 4 be lost silently while rebasing an "evil merge" containing 3 an "evil change" which does not 2 conflict with other commits.
Using --preserve-merges
does 1 not help in such a case.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.