Last active
December 20, 2015 13:29
-
-
Save romiguelangel/6139134 to your computer and use it in GitHub Desktop.
This file contains 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
# Linux terminal prompt colors (.bashrc) | |
PS1="\n\[$(tput bold)\]\[$(tput setaf 2)\]\u@\h \[$(tput setaf 3)\]\w\n\[$(tput setaf 7)\]\\$\[$(tput sgr0)\]" | |
# Mac, windows prompt colors | |
PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ ' | |
# Include branch | |
parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
parse_git_tag () { | |
git describe --tags 2> /dev/null | |
} | |
parse_git_branch_or_tag() { | |
local OUT="$(parse_git_branch)" | |
if [ "$OUT" == " ((no branch))" ]; then | |
OUT="($(parse_git_tag))"; | |
fi | |
echo $OUT | |
} | |
PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]$(parse_git_branch_or_tag)\n\$ ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment