Last active
August 29, 2015 14:16
-
-
Save dandeveloper/3fca71a5c78f7480ce57 to your computer and use it in GitHub Desktop.
Mostrar branch atual do git no terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #=========================================== | |
| # Váriavies com as Cores | |
| #=========================================== | |
| NONE="\[\033[0m\]" # Eliminar as Cores, deixar padrão) | |
| ## Cores de Fonte | |
| K="\[\033[0;30m\]" # Black (Preto) | |
| R="\[\033[0;31m\]" # Red (Vermelho) | |
| G="\[\033[0;32m\]" # Green (Verde) | |
| Y="\[\033[0;33m\]" # Yellow (Amarelo) | |
| B="\[\033[0;34m\]" # Blue (Azul) | |
| M="\[\033[0;35m\]" # Magenta (Vermelho Claro) | |
| C="\[\033[0;36m\]" # Cyan (Ciano - Azul Claro) | |
| W="\[\033[0;37m\]" # White (Branco) | |
| ## Efeito Negrito (bold) e cores | |
| BK="\[\033[1;30m\]" # Bold+Black (Negrito+Preto) | |
| BR="\[\033[1;31m\]" # Bold+Red (Negrito+Vermelho) | |
| BG="\[\033[1;32m\]" # Bold+Green (Negrito+Verde) | |
| BY="\[\033[1;33m\]" # Bold+Yellow (Negrito+Amarelo) | |
| BB="\[\033[1;34m\]" # Bold+Blue (Negrito+Azul) | |
| BM="\[\033[1;35m\]" # Bold+Magenta (Negrito+Vermelho Claro) | |
| BC="\[\033[1;36m\]" # Bold+Cyan (Negrito+Ciano - Azul Claro) | |
| BW="\[\033[1;37m\]" # Bold+White (Negrito+Branco) | |
| ## Cores de fundo (backgroud) | |
| BGK="\[\033[40m\]" # Black (Preto) | |
| BGR="\[\033[41m\]" # Red (Vermelho) | |
| BGG="\[\033[42m\]" # Green (Verde) | |
| BGY="\[\033[43m\]" # Yellow (Amarelo) | |
| BGB="\[\033[44m\]" # Blue (Azul) | |
| BGM="\[\033[45m\]" # Magenta (Vermelho Claro) | |
| BGC="\[\033[46m\]" # Cyan (Ciano - Azul Claro) | |
| BGW="\[\033[47m\]" # White (Branco) | |
| # Mostra branch atual do git no terminal | |
| parse_git_branch() { | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
| } | |
| export PS1="\[\033[0;31m\]\u\[\033[0;37m\]@\[\033[0;36m\]\h \[\033[0;37m\]\W\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ " |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notes:
Reference: http://martinfitzpatrick.name/article/add-git-branch-name-to-terminal-prompt-mac/