Sometimes when I do a pull instead of a rebase after a simple one file change commit I see the following in the master log:
Trivial merge
But there's no diff of what changed? What's the point of this log message? Did anything change I don't know of? It scares me.
git
doesn't insert this message into the log at any point. I'm going to take a wild guess and assume that you've seen this message in gitweb.
gitweb prints this message if there is no output from a combined diff. This happens when the only differences were all in chunks were only one side of the merge changed, and this change was brought through unmodified in the merge. This basically means there were no conflicts and nothing magic was added in the merge commit.
I confirm the only place in git codebase where the message "Trivial Merge" is displayed is in gitweb.perl, in the git_patchset_body()
function (right here):
if ($patch_number == 0) {
if (@hash_parents > 1) {
print "<div class=\"diff nodifferences\">Trivial merge</div>\n";
} else {
print "<div class=\"diff nodifferences\">No differences found</div>\n";
}
}
The document (included in Git documentation) trivial-merge.txt
does explain in detail all the cases which result in a "trivial merge" (and they were discussed in this thread)
git merge's help page (the one you get by typing "git help merge") states:
you received the same patch from an external source to produce the same result as what you are merging
来源:https://stackoverflow.com/questions/1824264/what-is-a-trivial-merge-in-git