Skip to content

Instantly share code, notes, and snippets.

@elia
Created April 6, 2011 10:18
Show Gist options
  • Save elia/905432 to your computer and use it in GitHub Desktop.
Save elia/905432 to your computer and use it in GitHub Desktop.
"project-dir:branch-name> " in git repos, "> " everywhere else (both are colored).
# To include this custom prompt put this file in "~/bin/" and and put the
# following lines in "~/.profile".
#
# # Include Custom prompt
# . ~/bin/elia-git-prompt.sh
clear=$'\[\e[0m\]'
red=$'\[\e[31m\]'
green=$'\[\e[32m\]'
yellow=$'\[\e[33m\]'
blue=$'\[\e[34m\]'
purple=$'\[\e[35m\]'
cyan=$'\[\e[36m\]'
gray=$'\[\e[37m\]'
function __git_base_dir {
(__gitdir > /dev/null) && cd "$(__gitdir)" && cd .. && basename "$(pwd)"
}
export PS1="$red\$(__git_base_dir)$green\$(__git_ps1 \":%s\")$yellow>$clear "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment