--cleanup=whitespace. This turns Git functionality to ignore lines with hash at the beginning off.
git commit --cleanup=whitespace
Alternatively You can use the hash sign when specifying commit message directly from command line.
git commit -m "#525 - ticket resolution"
Be aware! Do not forget to remove all # lines that you don't want to appear in git commit log, e.g. default Git summary describing commited files.