Skip to content

Instantly share code, notes, and snippets.

@jesuslg123
Last active October 9, 2019 09:07
Show Gist options
  • Save jesuslg123/ca27189a1896758fe3fe4eaea956525b to your computer and use it in GitHub Desktop.
Save jesuslg123/ca27189a1896758fe3fe4eaea956525b to your computer and use it in GitHub Desktop.
Bash prompt with time and branch
# Git branch & date in prompt.
COLOR_PROMT="\[\033[00m\]"
COLOR_GIT="\[\033[33m\]"
COLOR_DATE="\[\033[34m\]"
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="$COLOR_DATE[\t]$COLOR_PROMT \u@\h \W$COLOR_GIT\$(parse_git_branch)$COLOR_PROMT $ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment