Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

bash

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.

like image 641
Mohsen Avatar asked Nov 11 '13 18:11

Mohsen


1 Answers

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

like image 69
Barmar Avatar answered Oct 08 '22 08:10

Barmar