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 PS1='\[\e[37;40m\][\[\033[01;36m\]\u\[\e[37;40m\]@\[\e[0m\]\h \[\033[01;36m\]\W\[\033[01;32m\]$(git_branch)\[\033[00m\]\[\e[37;40m\]]\[\e[0m\]\$ '

 

保存退出,执行加载命令

source ./.bashrc

相关文章:

  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-03
  • 2022-12-23
  • 2021-09-25
  • 2022-12-23
  • 2021-12-17
  • 2021-06-08
相关资源
相似解决方案