I'm writing commit messages with vim on both my linux and my windows computers.
I'm using Bitbucket and GitHub as my repositories and would like to use some markup in commit messages to properly show the text in issues I link in my commits.
Now the problem is, that git removes those trailing whitespaces I usually use to achieve a newline on GitHub and Bitbucket.
Can this behaviour be altered? I've already searched the Git documentation but sadly didn't found anything.
What can I do to use some (or all) markups, but especially the 2-trailing-whitespaces one, in commits?
If you include --cleanup=verbatim
when you do a commit the message will not be altered (or add it to the config with git config add commit.cleanup verbatim
).
For more info git help commit
and git help config
As you note, none of the five choices for the --cleanup
option strip the commentary lines while also preserving trailing whitespace. As an alternative, commonmark allows a backslash for hard line breaks, which are always preserved in commit messages:
first line\
second line
This uglifies your git history slightly but it should display correctly on GitHub (example).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With