To prevent Git from including the comment lines (those starting with #) in your commit message when using git commit --cleanup=whitespace, you have a few options:
--cleanup=strip#) and leading/trailing whitespace from your commit message.bashgit commit --cleanup=strip
--cleanup=scissors# ------------------------ >8 ------------------------ (the "scissors" line), as well as comment lines and whitespace.bashgit config --global commit.cleanup strip
git commit will always use --cleanup=strip unless overridden.core.editor.Summary Table:
--cleanup=whitespace# lines.--cleanup=strip# lines and leading/trailing whitespace.--cleanup=scissors# lines, whitespace, and everything after scissors line.Recommendation:
If you always want to remove the # lines, use --cleanup=strip or set it as your default. If you want to keep some comments, use --cleanup=scissors or manually edit the message.