Sometimes I feel the urge to put some more expressiveness in my git commit messages. Unfortunately bash does not seem to like this.
iblue@silence ~/git/warga
In addition to using single quotes for exclamations, in most shells you can also use a backslash \
to escape it. That is:
git commit -m "Frustrating <insert object of frustration here>\!"
However, I personally recommend disabling bash expansion in you shell by adding set +H
or set +o histexpand
to your .bashrc
file.
If, like me, you never use bash expansion in your shell, disabling it will allow you to use exclamation points in any double-quote string - not only during your commits but for all bash commands.
Exclamation mark is preserved literally when you include it in a single-quoted string.
Example:
git commit -m 'Frustrating <insert object of frustration here>!'
Have a try this one
git commit -m "Frustrating <insert object of frustration here>"'!'
If in the middle of string then
"hello"'!'"world"
Use single quotes instead to prevent expansion.