Skip to content

Instantly share code, notes, and snippets.

@filipedfs
Created November 4, 2021 20:27
Show Gist options
  • Select an option

  • Save filipedfs/d2399847cc27037ac7746d05877e92a6 to your computer and use it in GitHub Desktop.

Select an option

Save filipedfs/d2399847cc27037ac7746d05877e92a6 to your computer and use it in GitHub Desktop.
Show git branch on terminal
# Add this code to .bashrc or .bash_profile file on ~/
# \u: usuário atual
# \h: nome da máquina (host)
# \H: nome da máquina completo
# \w: diretório de trabalho atual
# \W: diretório de trabalho atual com o nome base (último segmento) apenas
# $(__git_ps1 "%s"): branch atual caso esteja em um repositório git, senão exibe nada.
# azul: \[\033[0;34m\]
# vermelho: \[\033[0;31m\]
# vermelho fluorescente: \[\033[1;31m\]
# verde: \[\033[0;32m\]
# verde fluorescente: \[\033[1;32m\]
# branco forte: \[\033[1;37m\]
# cinza: \[\033[0;37m\]
# padrão: \[\033[0m\]
export PS1='\u@\h\[\033[01;34m\] \w\[\033[0;32m\]$(__git_ps1 " (%s)")\[\033[01;34m\]$\[\033[00m\] '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment