gitvim

Add a hash/pound symbol as the first character in a git commit message in vim


GitHub (probably, wrongly) uses #'s when referring to GitHub issues. So I would like to add a commit message that refers to the issue on the first line.

e.g.

#12: New commit

- Did a thing
- Did another thing

Vim/git ignores lines starting with #'s though so I'm not sure how to escape it 🤷‍♂️


Solution

  • Git allows you to update the comment char from the # symbol to any other. Then you can use the # symbol.

    e.g.

    git config core.commentChar '>'
    

    or optionally set it globally

    git config --global core.commentchar '>'