我用在Mac bash和別名之一是這樣的命令不認識bash命令別名
alias gitlog='git --no-pager log -n 20 --pretty=format:%h%x09%an%x09%ad%x09%s --date=short --no-merges'
然而,當我做
:! gitlog
我得到
/bin/bash: gitlog: command not found
我知道我可以在我的.gitconfig中添加這樣的別名
[alias]
co = checkout
st = status
ci = commit
br = branch
df = diff
但是我不想把所有的bash別名都添加到.gitconfig。那不是乾的。
有沒有更好的解決方案?
如果別名在.gitconfig中,那麼你不需要在你的Bash別名中重複它們,所有使用git的都會知道它們,而不僅僅是Bash。所以,DRY是令人欽佩的,但也有SPOT(單點的真相),讓你的SPOT在正確的位置意味着它更容易幹。 – 2011-05-29 14:34:11
請參閱:http://stackoverflow.com/a/9014154/1040358 – kikuchiyo 2012-01-28 17:09:30
可能的跨站點重複:http://superuser.com/questions/47821/vim-ignores-aliases – 2014-04-09 21:35:32