Created
August 9, 2015 15:47
-
-
Save jlord/c2472eec4a96c3a87558 to your computer and use it in GitHub Desktop.
Git branch in 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
BLUE='\e[0;34m'; | |
RED="\e[4;31m" | |
CYAN="\e[0;36m" | |
WHITE="\e[0;37m" | |
export PS1="$BLUE\${BRANCH}\e[m $WHITE@\u $CYAN\w:\[\e[0m\] " | |
function get_branch { | |
if [ -d .git ]; then | |
BRANCH="$(git branch | awk '/\*/ { print $2 }') ☁︎ " | |
else | |
BRANCH='➳' | |
fi | |
} | |
PROMPT_COMMAND="get_branch; $PROMPT_COMMAND" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment