Skip to content

Instantly share code, notes, and snippets.

@ksaitor
Forked from mnem/pretty_git_bash.sh
Created November 2, 2012 15:20
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 ksaitor/4001959 to your computer and use it in GitHub Desktop.
Save ksaitor/4001959 to your computer and use it in GitHub Desktop.
Prettifies bash terminals with git
# Setup the prompt so that it shows the current branch when in a git directory.
source /usr/local/etc/bash_completion.d/git-completion.bash
source /usr/local/etc/bash_completion.d/git-prompt.sh
function setup_prompts_for_git
{
local BLUE="\[\e[0;34m\]"
local RED="\[\e[0;31m\]"
local YELLOW="\[\e[0;33m\]"
local PURPLE="\[\e[0;35m\]"
local CLR_RESET="\[\e[0m\]"
case $TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="${TITLEBAR}$BLUE[$RED\$(date +%H:%M)$BLUE][$RED\u@\h:$PURPLE\w$YELLOW\$(__git_ps1)$BLUE]$CLR_RESET\n\$ "
PS2='> '
PS4='+ '
}
setup_prompts_for_git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment