通过命令行在Git提交消息中使用撇号(单引号)

编程入门 行业动态 更新时间:2024-10-10 14:31:41
本文介绍了通过命令行在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提交消息中使用撇号(单引号)

本文发布于:2023-10-12 16:12:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1485234.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令行   消息   单引号   Git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!