[英]How to configure command prompt in GIT with branch name. I get this error message: '-bash: __git_ps1: command not found'
我试图让GIT向我展示我正在处理的目录和分支。 这样,在我在GIT中键入任何内容之前,当我进入项目时,命令提示符将类似于:
project name (branch name) >
我尝试按照一个告诉我的〜目录中的.bash_profile的教程进行操作,如下所示:
#export PS1='jjberg '
alias ll='ls -lahG'
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
eval "$(rbenv init -)"
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
export PS1='\W$(__git_ps1 "(%s)") > '
fi
问题是,每当我在GIT中键入命令时,在执行所有操作后总是会附有错误消息。 看起来像这样:
-bash: __git_ps1: command not found
有人对我将如何解决这个问题有任何想法吗?
您是否不想考虑使用ZSH? 它将自动检测git存储库,就像您想要实现的那样。 它看起来像这样:
lan-chef-cookbooks git:(master) ✗
顺便说一句,我在Mac上使用它,但肯定有一个自动检测其他Linux / * nix发行版上的存储库的功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.