首页 > 代码库 > 配合Git修改PS1
配合Git修改PS1
1.export PS1=‘\u@\h:\[\033[1;34m\]\w\[\033[0;33m\]$(git branch 2> /dev/null | sed -e ‘/^[^*]/d‘ -e "s/* \(.*\)/[\1$([[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*")]/")\[\e[0m\]$ ‘
source:http://ryansechrest.com/2013/11/bash-shell-prompt-dissected-display-git-branch-name-status-color/
2.curl https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.sh
source:http://code-worrier.com/blog/git-branch-in-bash-prompt/
3.export PS1=‘\[\033[01;32m\]\h\[\033[01;34m\] \w\[\033[31m\]$(__git_ps1 "(%s)") \[\033[01;34m\]$\[\033[00m\] ‘
source:http://makandracards.com/makandra/524-show-the-current-git-branch-on-your-bash-prompt
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。