为什么 __git_ps1 不再在带有 MacPorts 的 OSX 上的 bash 中工作?

Ram*_*nte 2 bash shell macports macos

今天更新 Macports 后,我得到-bash: __git_ps1: command not found.

这是为什么?

Ram*_*nte 5

Macports 已将旧端口号更新git-coregit. 当更新您的端口 ( port upgrade outdated) 时,这会自动发生。

但是:如果您在 .profile 中使用了旧git-prompt.sh文件,您现在将收到消息-bash: __git_ps1: command not found.

这是因为文件的路径已更改。您应该将 .profile 更新为如下所示:

if [ -f /opt/local/share/git/contrib/completion/git-prompt.sh ]; then                                                                                         
. /opt/local/share/git/contrib/completion/git-prompt.sh
fi
Run Code Online (Sandbox Code Playgroud)