作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我在 Windows 10 专业版机器上使用 Cmder使用 Git 版本 2.15.0.windows.1
。
我想为 git log 命令设置一个带有一些漂亮选项的别名。命令是:
log --pretty=format:"%C(yellow)%h%Cred%d %Creset%s%Cblue [%cn]" --decorate
当我尝试通过运行此命令来设置别名时:
git config --global alias.ls "log --pretty=format:"%C(yellow)%h%Cred%d %Creset%s%Cblue [%cn]" --decorate"
它不起作用,别名未注册。我怀疑这是因为我在命令中也有双引号。
我也试过用单引号'
把它包起来,但这也不管用。
如何在命令中转义那些双引号以便别名注册?
最佳答案
对 pretty=format 字符串使用单引号。
git config --global alias.ls "log --pretty=format:'%C(yellow)%h%Cred%d %Creset%s%Cblue [%cn]' --decorate"
关于windows - Windows 上的 Git 别名 : How to escape double quotes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47631492/
我是一名优秀的程序员,十分优秀!