Note to mods: This is not a duplicate of Start a Git commit message with a hashmark (#). That question is specifically regarding git commit
, while this is regarding .gitconfig file syntax.
A web search will turn up many answers for how to escape a hash at the beginning of a commit message, but I'm unable to find any solution for including a hash in an alias in a .gitconfig file. This is the alias I'm trying to use:
[alias]
pr-log = !git fetch && git log --reverse --pretty=format:\"### [%s](https://github.com/my-username/commit/%H)%n%n%b\" HEAD...origin/develop
When run in the shell this produces nicely formatted markdown, but since # is a comment character in .gitconfig, it gets parsed as pr-log = log --reverse --pretty=format:\"
. I tried \#\#\#
, but that doesn't work.