Skip to content

Instantly share code, notes, and snippets.

@grayside
Created May 9, 2013 18:34
Show Gist options
  • Save grayside/5549523 to your computer and use it in GitHub Desktop.
Save grayside/5549523 to your computer and use it in GitHub Desktop.
Terminal Prompt Snippet
##
# Copy this into your .bash_profile.
#
# It will show timestamp, working directory, and if available, your git branch.
#
# This snippet may evolve as I change my personal preferences, be sure to create your own canonical copy.
##
function prompt_command() {
local branch=`git rev-parse --abbrev-ref HEAD 2>/dev/null`
if [ "$branch" ]
then
branch=" ($branch)"
fi
export PS1="\n\[\e[33m\][\t] \w${branch} \$\[\e[0m\] "
}
PROMPT_COMMAND=prompt_command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment