ignore bash backtick execution without escaping the ` character in git commit [duplicate]

I use backtick character in my commits very often. I also usually commit using git commit -m

When I run a command like this

git commit -m "add `foo`"

Bash tries to execute foo.

I can use backslash \ to escape the backtick but I am wishing for a better solution to avoid escaping backtick all the time.


Solution 1:

Use single quotes instead of double quotes.

git commit -m 'add `foo`'

Variables, backticks, and $(...) are expanded in double quotes, but not single quotes.

See Difference between single and double quotes in Bash