linux配置显示git分支名
在~/.bashrc文件中加入如下内容:
alias ll="ls -lh " alias gs="git status " alias gc="git checkout " alias gb="git branch " alias gm="git merge " parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } export PS1="\u@\w\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
然后执行:source ~/.bashrc即可.
Mac可以修改/etc/bashrc,否则每次重启终端都要source ~/.bashrc
git颜色配置:
git config --global color.ui true