Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@mnem

This comment has been minimized.

Copy link
Owner Author

commented Sep 20, 2010

Show git branch in shell prompt

Plop this at the end of your ~/.profile or ~/.bash_profile file to make your prompt vibrant and also display the current git branch you are working in.

Preview

Vibrant Paths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.