mac 自己的bash_profile配置

在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

解决方案.png

现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\] \$ '
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容