Created
May 9, 2013 18:34
-
-
Save grayside/5549523 to your computer and use it in GitHub Desktop.
Terminal Prompt Snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# 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