Skip to content

Instantly share code, notes, and snippets.

@marceloboeira
Created November 28, 2014 03:18
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 marceloboeira/9c119d8aa50e554eeae8 to your computer and use it in GitHub Desktop.
Save marceloboeira/9c119d8aa50e554eeae8 to your computer and use it in GitHub Desktop.
mac_ps1
alias __git_ps1="git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/(\1)/'"
# enable the git bash completion commands
source ~/.git-completion.bash
# enable git unstaged indicators - set to a non-empty value
GIT_PS1_SHOWDIRTYSTATE="."
# enable showing of untracked files - set to a non-empty value
GIT_PS1_SHOWUNTRACKEDFILES="."
# enable stash checking - set to a non-empty value
GIT_PS1_SHOWSTASHSTATE="."
# enable showing of HEAD vs its upstream
GIT_PS1_SHOWUPSTREAM="auto"
BLACK=$(tput setaf 0)
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
LIME_YELLOW=$(tput setaf 190)
POWDER_BLUE=$(tput setaf 153)
BLUE=$(tput setaf 4)
MAGENTA=$(tput setaf 5)
CYAN=$(tput setaf 6)
WHITE=$(tput setaf 7)
BRIGHT=$(tput bold)
NORMAL=$(tput sgr0)
BLINK=$(tput blink)
REVERSE=$(tput smso)
UNDERLINE=$(tput smul)
PS1='${BRIGHT} [`date "+%H:%M"`] ${WHITE}\w${NORMAL}$(git branch &>/dev/null;\
if [ $? -ne 0 ]; then \
echo "'$NORMAL' \$ "; \
else \
echo " '$NORMAL'$(echo `git status` | grep "nothing to commit" > /dev/null 2>&1; \
if [ "$?" -eq "0" ]; then \
echo "'$GREEN'"$(__git_ps1); \
else \
echo "'$RED'"$(__git_ps1); \
fi)'$NORMAL' \$ "; \
fi)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment