Last active
June 16, 2020 10:43
-
-
Save vterdunov/c1b5f2dc42b7692a2817df79823913d5 to your computer and use it in GitHub Desktop.
Gets tracking branch name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_branch_tr_name() { | |
local br_name | |
br_name=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null) | |
if [[ -n $br_name ]]; then | |
echo "[$(__git_ps1 "%s")->${br_name}]" | |
else | |
__git_ps1 ["%s"] | |
fi | |
} | |
RESET="\[\033[00m\]" | |
RED="\[\033[0;31m\]" | |
GREEN="\[\033[01;32m\]" | |
BLUE="\[\033[01;34m\]" | |
DARK_BLUE="\[\033[0;36m\]" | |
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\w\\a\]┌─${BLUE}\w${RESET}${DARK_BLUE}\$(get_branch_tr_name)${RESET}\n└─\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment