Skip to content

Instantly share code, notes, and snippets.

@dekadentno
Last active August 5, 2018 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dekadentno/47c206dee5d25889beee2ae4dd2c788f to your computer and use it in GitHub Desktop.
Save dekadentno/47c206dee5d25889beee2ae4dd2c788f to your computer and use it in GitHub Desktop.
.bashrc
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
# example 1
export PS1="🍔 \[\033[01;35m\]\u@\h:\[\033[01;34m\]\$(parse_git_branch) \[\033[01;32m\]\w \[\033[01;34m\]\n>\[\e[0m\]"
# example 2
export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \[\033[0;36m\]\h \w\[\033[0;32m\] $(parse_git_branch)\n\[\033[0;32m\]└─\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\] ▶\[\033[0m\] '
# put changes to current shell enviroment:
```bash
source .bashrc
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment