1. vim ~/.bashrc
PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\[\033[31m\]$(git_branch)\[\033[01;34m\] \$\[\033[00m\] '
#Get Git branch information

tagsstart

<i class="fa fa-tags" aria-hidden="true"></i> [Git](/tags.html#git) [shell](/tags.html#shell)

tagsstop

function git_branch {
  ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
  echo "("${ref#refs/heads/}")";
}
  1. source ~/.bashrc
© Kimi Tsai all right reserved.            Updated : 2023-07-12 09:04:54

results matching ""

    No results matching ""

    results matching ""

      No results matching ""