【发布时间】:2013-09-23 09:26:12
【问题描述】:
我的 .bash_profile 中已经设置了一堆可以正常工作的 git 别名:
alias gst="git status"
alias gl="git pull"
alias gp="git push"
alias gd="git diff | mate"
alias gc="git commit -v"
alias gca="git commit -v -a"
alias gb="git branch"
alias gba="git branch -a"
我正在尝试为以下命令添加别名,但一直遇到错误:
git log --all --pretty=format:'%h %cd %s (%an)' --since='7 days ago'
我想做的是能够打字:
glog 'some amount of time'
所以,作为别名和 git 的新手,我认为这可行:
alias glog="git log --all --pretty=format:'%h %cd %s (%an)' --since="
它会抛出以下错误:
fatal: ambiguous argument '7 days ago': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
如何更正我的别名以使其正常工作?
谢谢!
[编辑]
如果我将别名更改为:
alias glog="git log --all --pretty=format:'%h %cd %s (%an)'"
然后输入:
glog --since='some amount of time'
但如果可能的话,我真的很想输入时间。
【问题讨论】:
标签: git bash terminal alias .bash-profile