I am using git version 2.16.2 on macOS Mojave (but I've seen this on other versions too) and I am observing a strange behaviour of git commit -v
.
Sometimes when I write my commit message and close the editor (nano in my case) the commit message gets changed and the commit diff is added to the message.
For example:
commit c7f28bc4849318a542fe6312444f3a72d82787f0
Author: Ivan Dokov <***@gmail.com>
Date: Tue Oct 16 16:33:49 2018 +0300
Firm Notes deletion
diff --git a/src/app/pages/firm/firm-notes/firm-notes.component.html b/src/app/pages/firm/firm-notes/firm-notes.component.html
index 2267393..f0cfed4 100644
--- a/src/app/pages/firm/firm-notes/firm-notes.component.html
+++ b/src/app/pages/firm/firm-notes/firm-notes.component.html
@@ -14,17 +14,38 @@
...
I think it happens when I do not leave an empty line before:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
This behaviour is not consistent. Usually I do not leave an empty line and it works as it should but when I actually see the bad commit message I amend the commit and add an empty line and the issue is resolved. The problem is that I do not always keep an eye on the commit message after I make the commit and I push such bad commit messages to the repository.
Unfortunately I am the only one using git commit -v
in the office and nobody else is observing such an issue.
Here is my gitconfig.
Google also is not helping as I cannot seem to find any posts with similar issues.
Update: I just found out that adding an empty line after my commit message is not always solving the issue.