Terminal git 显示当前分支
2017-02-20 22:50
225 查看
增加到 /etc/brashrc
find_git_branch () { local dir=. head until [ "$dir" -ef / ]; do if [ -f "$dir/.git/HEAD" ]; then head=$(< "$dir/.git/HEAD") if [[ $head = ref:\ refs/heads/* ]]; then git_branch=" | ${head#*/*/}" elif [[ $head != '' ]]; then git_branch=" | (detached)" else git_branch=" | (unknow)" fi return fi dir="../$dir" done git_branch='' } PROMPT_COMMAND="find_git_branch; $PROMPT_COMMAND" PS1="\u@\h:\w\$git_branch\$ "
相关文章推荐
- 让terminal显示git所在的当前分支名
- 在Mac、Linux 终端显示 Git 当前所在分支
- Shell 显示所在项目当前git分支及状态
- 让 shell 显示当前 git 的分支名称
- 在Mac、Linux 终端显示 Git 当前所在分支
- 终端shell显示当前git分支_修订版
- Mac系统的终端显示git当前分支
- 在Terminal中显示git的当前branch
- 在Mac、Linux 终端显示 Git 当前所在分支
- 在Mac、Linux 终端显示 Git 当前所在分支
- GIT 自动补全命令,分支名 以及 高亮显示当前分支
- 在Mac、Linux 终端显示 Git 当前所在分支
- shell提示符显示git当前分支
- linux 显示所在项目当前分支及git状态
- linux 命令行终端显示git 当前所在分支
- Mac系统的终端显示git当前分支
- 在git上拉取代码之后如何在idea右下方显示当前操作分支
- 在Mac、Linux 终端显示 Git 当前所在分支
- git在MAC,Linux的terminator(命令行)下自动显示当前分支
- 让Terminal显示git分支