Start a Git commit message with a hashmark (#)

Git treats lines starting with # as comment lines when committing. This is very annoying when working with a ticket tracking system, and trying to write the ticket number at the beginning of the line, e.g.

#123 salt hashed passwords

Git will simply remove the line from the commit message. Is there a way to escape the hash? I tried \ and !, but nothing works. Whitespace before # is preserved, so that’s not a working solution to the problem either.

9 Answers
9

Leave a Comment