(Mac) -bash: __git_ps1: command not found

后端 未结 19 2036
感动是毒
感动是毒 2020-11-30 16:20

I\'m trying to change my command promt in terminal. I keep getting the error:

-bash: __git_ps1: command not found

I\'ve tried it just by typing

19条回答
  •  清歌不尽
    2020-11-30 16:53

    Yet another option I just installed on Mojave: magicmonty/bash-git-prompt

    Run (brew update) and brew install bash-git-prompt or brew install --HEAD bash-git-prompt

    Then to your ~/.bash_profile or ~/.bashrc:

    if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then
      __GIT_PROMPT_DIR=$(brew --prefix)/opt/bash-git-prompt/share
      GIT_PROMPT_ONLY_IN_REPO=1
      source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh"
    fi
    

    I'm happy.

提交回复
热议问题