Skip to content

Instantly share code, notes, and snippets.

@codewithleader
Last active October 3, 2022 20:31
Show Gist options
  • Save codewithleader/efa0a704ec57bccfefee8031f6151e0c to your computer and use it in GitHub Desktop.
Save codewithleader/efa0a704ec57bccfefee8031f6151e0c to your computer and use it in GitHub Desktop.
Branch Name Terminal Ubuntu: Ver la rama en la linea de comandos de la terminal de Ubuntu. Tipo: elis@perezmusic ~/home/my-app (main) $

Ver el branch name en la terminal pegar este condigo en el .bashrc (control + h para ver archivos ocultos)

# Show git branch name Elis Antonio
mostrar_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[36m\]\$(mostrar_git_branch)\[\033[00m\] $ "

Options color: Podemos cambiar el color del branch sustituyendo el código [36m], por el código correspondiente al color:

Negro [30m\]
Rojo [31m\]
Verde [32m\]
Amarillo [33m\]
Azul [34m\]
Magenta [35m\]
Cyan [36m\]
Blanco [37m\]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment