Use of an exclamation mark in a Git commit message via the command line

后端 未结 6 808
面向向阳花
面向向阳花 2020-12-07 12:52

How do I enter an exclamation point into a Git commit message from the command line?

It is possible to escape the exclamation point with a backslash, but then the ba

6条回答
  •  悲&欢浪女
    2020-12-07 13:40

    Use single quotes instead of double quotes

    git commit -am 'Nailed it!'
    

    Alternatively, if you need to use double quotes for whatever reason but still want a literal ! then turn off history expansion at the top of your script via set +H

提交回复
热议问题