Skip to content

Instantly share code, notes, and snippets.

@jlord
Created August 9, 2015 15:47
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 jlord/c2472eec4a96c3a87558 to your computer and use it in GitHub Desktop.
Save jlord/c2472eec4a96c3a87558 to your computer and use it in GitHub Desktop.
Git branch in terminal
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