开发工具 git alias 问题,关于 git log --graph 格式化

sailorhero · 2013年03月05日 · 最后由 sailorhero 回复于 2013年03月05日 · 5112 次阅读

Window XP 系统下,执行命令行:

>git log --graph  --abbrev-commit --date=relative --pretty=format:"%Cred%h%Creset -%C(yello
w)%d%Creset %s %Cgreen(%Cblue%an%Creset%Cgreen %cr)%Creset "

输出如下:

WARNING: terminal is not fully functional
* 22c95e6 - (HEAD, base_project_with_guard_and_spork, origin/master, master) add
* 8b84cd0 - add Guard_spork for use Guard to load spork (sailorhero 3 days ago)
* 2e33813 - add spork to fast testing (sailorhero 3 days ago)
* 3de3a63 - add Guard support for AutoTesting (sailorhero 3 days ago)
* 2d364ad - (static-pages) use before to improve static_pages_spec.rb (sailorher
* ea1787b - Finish static pages (sailorhero 3 days ago)
* 485c8c6 - Add a StaticPages controller (sailorhero 3 days ago)
* d569e42 - Rails工程生成添加Rspec支持 (sailorhero 3 days ago)
* df5b15b - 添加ignore定义刷新README说明 (sailorhero 3 days ago)
* 127b2a9 - first commit to add README.md (sailorhero 3 days ago)
(END)

但配置 alias 到$home/.gitconfig 中

[alias]
co = checkout
br = branch
ci = commit
st = status
last = log --pretty=oneline -1 HEAD
glog = log --graph  --abbrev-commit --date=relative --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%Cblue%an%Creset%Cgreen %cr)%Creset "

执行,命令行执行git glog,报如下错误

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>...]'

求解....

把 format 字符串的双引号换成单引号

#1 楼 @kenshin54 果然如此,配置文件中换成单引号后,一切正常。多谢!

需要 登录 后方可回复, 如果你还没有账号请 注册新账号