Search code examples
gitgithubcommonmark

do not remove whitespace in git commit messages


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?


Solution

  • 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