[git] IDEA-115594 Don't join equal commit messages from different roots

(cherry picked from commit f4ea819520c44e991c3f9d0a89cace1aa014a73c)
[git] IDEA-116738 Don't eat newlines when amending

%s removes line endings from the subject area.
To fix this use %B to get the whole commit message.
It works for Git 1.7.2+.
Keep behavior for Git 1.7.1: old version; no easy workaround;
multiline subjects are not recommended.

(cherry picked from commit a6f80fcd9c0bd095f15aa2b40701f308106f8529)