Skip to content

Instantly share code, notes, and snippets.

@abel0b
Created April 25, 2020 11:34
Show Gist options
  • Save abel0b/bd22cc9c47f301892a77627c9e3468e5 to your computer and use it in GitHub Desktop.
Save abel0b/bd22cc9c47f301892a77627c9e3468e5 to your computer and use it in GitHub Desktop.
Prompt bash git branch + previous command exit code
export PS1='$(if [[ ! "$?" = "0" ]]; then echo "\[\e[1;31m\]($?)\[\e[0m\] "; fi)\h:\[\e[1;31m\]$(basename $PWD)\[\e[0m\]\[\e[1;33m\]$(__git_ps1 " [%s]")\[\e[0m\]> '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment