自动显示分支
- ~/.bashrc 里添加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 }
自动补全分支
-
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
-
~/.bashrc里添加if [ -f ~/.git-completion.bash ]; then . ~/.git-completion.bash fi
-
source ~/.bashrc,重启idea。