Skip to content

Instantly share code, notes, and snippets.

@emersonmello
Created August 22, 2022 20:24
Show Gist options
  • Save emersonmello/27a2b007c9fda38cf03f92da926e923e to your computer and use it in GitHub Desktop.
Save emersonmello/27a2b007c9fda38cf03f92da926e923e to your computer and use it in GitHub Desktop.
Personalizações do .bashrc
# Alterando o prompt (variável PS1) para refletir o status do repositório git
# Adaptações de soluções presentes em https://gist.github.com/justintv/168835
function situacao_repo_git() {
if [[ $(git status -s 2> /dev/null) ]]; then
echo -ne "\e[0;33m$(__git_ps1)\033[0m";
else
echo -ne "\e[0;32m$(__git_ps1)\033[0m";
fi
}
export PS1='\u@\[\e[1;31m\]\h \w\[\e[0m\]$(situacao_repo_git)\e[0m\] \$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment