我有一个像这样的gitconfig:
[alias]
l = "!source ~/.githelpers && pretty_git_log"
当我运行它时,会得到这个结果:
[desktop] git l
source ~/.githelpers && pretty_git_log: 1: source: not found
error: cannot run source ~/.githelpers && pretty_git_log: No such file or directory
fatal: While expanding alias 'l': 'source ~/.githelpers && pretty_git_log': No such file or directory
当我添加任何其他shell内建命令进行测试时,它们都可以正常运行:
[alias]
l = "!echo running from the builtin"
[desktop] git l
running from the builtin
你有没有想过为什么在git中找不到source命令?我正在使用zsh,但是改成bash好像没有任何区别:
[desktop] bash
[desktop] git l
source ~/.githelpers && pretty_git_log: 1: source: not found
error: cannot run source ~/.githelpers && pretty_git_log: No such file or directory
fatal: While expanding alias 'l': 'source ~/.githelpers && pretty_git_log': No such file or directory