我有這樣一個gitconfig:gitconfig走樣不工作(zsh中)
[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
當我添加任何其他殼內置測試,他們運行良好:
[alias]
l = "!echo running from the builtin"
[desktop] git l
running from the builtin
任何想法爲什麼無法從git中找到源命令?我運行的zsh,但改變抨擊似乎沒有有所作爲:
[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
對不起,如果問題是愚蠢的,但爲什麼你需要預先'源'? – CharlesB
這實際上是Gary Bernhardt的gitconfig和.githelpers的一個例子,他有一個名爲pretty_git_log()的函數。我認爲源代碼調用會使命令行中的命令pretty_git_log可用,但不完全確定。 – user1244166