让 shell 显示当前 git 的分支名称
2017-02-23 17:05
519 查看
vim ~/.bashrc
添加下列代码:
source ~/.bashrc
英文原文
添加下列代码:
function git-branch-name { git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3 } function git-branch-prompt { local branch=`git-branch-name` if [ $branch ]; then printf " [%s]" $branch; fi } PS1="\u@\h \[\033[0;36m\]\W\[\033[0m\]\[\033[0;32m\]\$(git-branch-prompt)\[\033[0m\] \$ "
source ~/.bashrc
英文原文
相关文章推荐
- shell脚本----在 Shell 提示符中显示 Git 分支名称
- 在 Shell 提示符中显示 Git 分支名称的方法
- 终端shell显示当前git分支_修订版
- 在 Shell 提示符中显示 Git 分支名称的方法
- 在 Shell 提示符中显示 Git 分支名称
- Shell 显示所在项目当前git分支及状态
- 在 Shell 提示符中显示 Git 分支名称的方法
- shell提示符显示git当前分支
- 在Mac、Linux 终端显示 Git 当前所在分支
- Shell颜色及显示git分支配置
- git在MAC,Linux的terminator(命令行)下自动显示当前分支
- linux 显示所在项目当前分支及git状态
- ubuntu 下显示 git代码仓库的 分支名称
- 查看某一个shell脚本在什么位置 显示当前操作系统的名称
- GIT 自动补全命令,分支名 以及 高亮显示当前分支
- 在git上拉取代码之后如何在idea右下方显示当前操作分支
- Mac系统的终端显示git当前分支
- 在Mac、Linux 终端显示 Git 当前所在分支
- git获取当前分支名称
- 在Mac、Linux 终端显示 Git 当前所在分支