通过命令行在Git提交消息中使用撇号(单引号) [英] Use of apostrophe (single-quote) in a Git commit message via command line

查看:150
本文介绍了通过命令行在Git提交消息中使用撇号(单引号)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用又一步。

I am trying to take this one step further. How could this work in a standard Bash shell?

git commit -m 'cracked enigma's code'

是否可以像下面这样简单地通过反斜杠转义呢?

Could this simply be done with backslash-escaping like the following?

git commit -m 'cracked enigma\'s code'

进一步,如何使用双引号?还通过反斜杠转义吗?那是最好的方法吗?有什么好的替代方法吗?

Further, how could double-quotes be used? Also by backslash-escaping? Would that be the best way? Are there any good alternative ways?

git commit -m 'cracked the "real" enigma's code'


推荐答案

使用双引号:

git commit -m "cracked enigma's code"

,如果您的邮件中包含其他特殊字符,则仅对单引号使用双引号或反斜杠:

Or, if your message contains other special characters, use double quotes or backslash only for the single quote:

git commit -m 'cracked $enigma'"'"'s code'
git commit -m 'cracked $enigma'\''s code'

这篇关于通过命令行在Git提交消息中使用撇号(单引号)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆