Skip to content

Instantly share code, notes, and snippets.

@mshafeeqkn
Last active July 18, 2024 03:12
Show Gist options
  • Save mshafeeqkn/794d26711a7201552354493c7a2e77ee to your computer and use it in GitHub Desktop.
Save mshafeeqkn/794d26711a7201552354493c7a2e77ee to your computer and use it in GitHub Desktop.
The PS1 variable for bashrc
parse_git_branch() {
_branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/')
_branch="$_branch"
echo $_branch
}
export PS1="\[\033[38;5;42m\]\u@\h\[\033[00m\]:\[\033[38;5;39m\]\W\[\033[38;5;198m\]\$(parse_git_branch)\[\033[00m\]$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment