Skip to content

Instantly share code, notes, and snippets.

@FelipeGangrel
Last active May 13, 2022 00:07
Show Gist options
  • Save FelipeGangrel/5365bf7e1f3a4650b116440516841f76 to your computer and use it in GitHub Desktop.
Save FelipeGangrel/5365bf7e1f3a4650b116440516841f76 to your computer and use it in GitHub Desktop.
My Bash PS1
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(\1$(parse_git_dirty))/"
}
export PS1='\[\e[\033[01;34m\]\u@\h \[\e[38;5;211m\]\W\[\e[\033[38;5;48m\] $(parse_git_branch)\[\e[\033[00m\]\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment