Forked from danielalvarenga/terminal-colors-branch.sh
Created
September 15, 2021 08:27
-
-
Save avally/592677d542994615520c104c132e4ff1 to your computer and use it in GitHub Desktop.
Show branch in terminal Ubuntu
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
| # Add in ~/.bashrc or ~/.bash_profile | |
| function parse_git_branch () { | |
| # The line below is changed. | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \(\1)/' | |
| } | |
| RED="\[\033[01;31m\]" | |
| YELLOW="\[\033[01;33m\]" | |
| GREEN="\[\033[01;32m\]" | |
| BLUE="\[\033[01;34m\]" | |
| NO_COLOR="\[\033[00m\]" | |
| # without host | |
| PS1="$GREEN\u$NO_COLOR:$BLUE\w$YELLOW\$(parse_git_branch)$NO_COLOR\$ " | |
| # with host | |
| # PS1="$GREEN\u@\h$NO_COLOR:$BLUE\w$YELLOW\$(parse_git_branch)$NO_COLOR\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment