在Mac、Linux 终端显示 Git 当前所在分支:https://gist.github.com/yisibl/8281454
Mac版git命令自动补全:https://blog.csdn.net/WinWill2012/article/details/71774461
题 如何配置git bash命令行完成?:
http://landcareweb.com/questions/5247/ru-he-pei-zhi-git-bashming-ling-xing-wan-cheng
现bash_profile的配置
M2_HOME=/Users/xxx/tools/apache-maven-3.5.3
PATH=$M2_HOME/bin:$PATH
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
source ~/.git-completion.bash
function git_branch {
branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`"
if [ "${branch}" != "" ];then
if [ "${branch}" = "(no branch)" ];then
branch="(`git rev-parse --short HEAD`...)"
fi
echo " ($branch)"
fi
}
export M2_HOME
export PATH
export PS1='\u@\h \[\033[01;36m\]\W\[\033[01;32m\]$(git_branch)\[\033[00m\] \$ '