'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 1:[1]
The simplest way to avoid git interpreting the issue number as a comment line, is to insert another character before, so the # is not the leading character of the line (a space will do the trick).
Here is an example:
#45
will be seen as a comment
#45
Issue #45
will both be taken entirely as commit messages
Solution 2:[2]
Try: git commit --amend -m "# ... "
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Yannoff |
| Solution 2 | IsraelDax |
