[英]Git alias on Windows: How to escape double quotes
I am on a Windows 10 Pro Machine and I am using Cmder with Git version 2.15.0.windows.1
. 我在Windows 10 Pro机器上,我使用Cmder与Git版本
2.15.0.windows.1
。
I want to set up an alias for the git log command with some pretty options. 我想使用一些漂亮的选项为git log命令设置别名。 The command is:
命令是:
log --pretty=format:"%C(yellow)%h%Cred%d %Creset%s%Cblue [%cn]" --decorate
When I try to set the alias up by running this command: 当我尝试通过运行此命令设置别名时:
git config --global alias.ls "log --pretty=format:"%C(yellow)%h%Cred%d %Creset%s%Cblue [%cn]" --decorate"
It does not work, the alias is not registered. 它不起作用,别名未注册。 I suspect it is because I have double quotes within the command too.
我怀疑是因为我在命令中也有双引号。
I also tried wrapping it with single quotes '
, but that does not work either. 我也试过用单引号包装它
'
,但这并不能工作。
How can I escape those double quotes within the command so that the alias does register? 如何在命令中转义那些双引号,以便别名注册?
对pretty = format字符串使用单引号。
git config --global alias.ls "log --pretty=format:'%C(yellow)%h%Cred%d %Creset%s%Cblue [%cn]' --decorate"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.