在Bash命令提示符下添加git branch
我试图添加git分支我目前工作(签出)在bash提示没有成功..(同时保持我的当前路径显示活动目录/文件完好无损)
我在我家有一个.bashrc文件,但我也看到很多人提到.profile文件..
注意这种提示现在由
contrib/completion/ git-prompt.sh 及其__git_ps1_branch_name变量管理。
source ~/.git-prompt.sh
Bash: PS1='[u@h W$(__git_ps1 " (%s)")]$ ' ZSH: setopt PROMPT_SUBST ; PS1='[%n@%m %c$(__git_ps1 " (%s)")]$ ' 但请注意,只有git 1.9.3(2014年5月)or later允许您安全地显示该分支名称(!) 见commit 8976500 by Richard Hansen (
'$(IFS=_;cmd=sudo_rm_-rf_/;$cmd)'. 什么愚蠢的心会命名这样的分支? ;)(Beside a Mom as in xkcd) still_dreaming_1 reports in the comments:
PS1='[e]0;u@h: wa]n${debian_chroot:+($debian_chroot)}[ 33[01;32m]u@h[ 33[00m]:[ 3??3[01;34m]w[ 33[00m]$(__git_ps1)$ '
在Linux Mint 17.3肉桂64位: PS1='${debian_chroot:+($debian_chroot)}[ 33[01;32m]u@h[ 33[01;34m] w[ 33[00m]$(__git_ps1) $ ' (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |