【发布时间】:2015-12-05 23:05:27
【问题描述】:
受this 回复关于 git log 格式的十六进制颜色代码的启发,我尝试做同样的事情。在终端中直接使用它,它工作正常:
$git log --format="%h%C(#ff69b4)%d%C(reset) %s"|head -1
dc814e3 (HEAD -> master, origin/master, origin/HEAD) Compilation help added
如果我在.gitconfig 的别名中添加log --format="%h%C(#ff69b4)%d%C(reset) %s" 部分,则会出现问题:
[alias]
ll =log --format="%h%C(#ff69b4)%d%C(reset) %s"
给出错误:
$git ll
fatal: ambiguous argument '%s': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
搜索给出了同一类型问题here 的解决方案:建议尝试用\" 转义"。
如果我这样做,例如
[alias]
ll =log --format=\"%h%C(#ff69b4)%d%C(reset) %s\"
我得到错误:
git ll
fatal: Bad alias.ll string: unclosed quote
我正在使用:
$echo $TERM; echo $SHELL; git --version
xterm-256color
/bin/bash
git version 2.4.3
我在这里做错了什么?
【问题讨论】:
标签: git