melaniecrissey.com

Quotes Matter

January 08, 2022

Yesterday I was making some changes to my blog and I was feeling extra enthusiastic. So, I made a commit message with some exclamation points, like so:

git commit -m "Ship ship!"

But, the terminal spat some garbage back at me:

dquote> ›

It did not like my exclamation point within my commit message.

Can you spot the problem?

I used the wrong type of quotes!

I learned you must use ‘single quotes’ around your commit message if you’re going to include certain types of punctuation, like an exclamation point, inside.

But, why do the “double quotes” work, without exclamation points…?

It seems the double quotes are a fall back in case your commit message needs to contain an apostrophe, like so:

git commit -m "Mel's Diner"

because if you try to do

git commit -m 'Mel's Diner'

then your commit message will break and you’ll get more garbage from the terminal, like:

quote>

Mystery solved.