Skip to content

Instantly share code, notes, and snippets.

@nosami
Forked from bradwilson/_readme.md
Created March 13, 2016 23:31
Show Gist options
  • Save nosami/0c9fcc2fc100dd1dd451 to your computer and use it in GitHub Desktop.
Save nosami/0c9fcc2fc100dd1dd451 to your computer and use it in GitHub Desktop.
bash-git prompt overrides

CAVEAT: This works for me on Linux Mint 17.3. YMMV, caveat emptor, etc.

If this looks like (like maybe it should be a bash-git theme), hey, I agree with you, but I spent as many hours struggling with doing this "the right way" as I'm willing to put in.

Some of the custom characters come from Font Awesome. You should install the Font Awesome font into your system to use them. They may have what appears to be odd extra-spacing owing to the fact that Font Awesome is not fixed pitch, but Terminal expects it to be.

Add the following three lines to your .bashrc:

source ~/.bash-git-prompt/gitprompt.sh
source ~/.bash-git-prompt/prompt-colors.sh
source ~/.git-prompt-overrides.sh

Also you'll note that my prompt does not contain username or path information in it; that's because I prefer to put that into the title bar:

export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
Time12a="\$(date +%H:%M)"
# Configuration
GIT_PROMPT_SHOW_UNTRACKED_FILES="all"
GIT_PROMPT_IGNORE_STASH="1"
# Pre- and post-status prompt strings
GIT_PROMPT_COMMAND_FAIL="${ResetColor} ${RedBg}${BrightWhite} ✘-_LAST_COMMAND_STATE_ ${ResetColor}"
GIT_PROMPT_COMMAND_OK=""
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_"
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_ROOT}"
GIT_PROMPT_END_USER="${ResetColor} ${BoldWhite}${Time12a}${BoldGreen} $ ${ResetColor}"
GIT_PROMPT_END_ROOT="${ResetColor} ${BoldWhite}${Time12a}${BoldRed} # ${ResetColor}"
# Individual overrides
GIT_PROMPT_BRANCH="${DimBlueBg}${BoldWhite}"
GIT_PROMPT_CHANGED="${DimBlueBg}${BoldYellow} ~"
GIT_PROMPT_CLEAN=""
GIT_PROMPT_CONFLICTS="${DimBlueBg}${BoldRed} ×"
GIT_PROMPT_PREFIX="${DimBlueBg}${BrightWhite}  "
GIT_PROMPT_REMOTE="${DimBlueBg}"
GIT_PROMPT_SEPARATOR=""
GIT_PROMPT_STAGED="${DimBlueBg}${BoldGreen} ±"
GIT_PROMPT_SUFFIX="${DimBlueBg}${DimBlueBg} "
GIT_PROMPT_UNTRACKED="${DimBlueBg}${BoldYellow} +"
# Symbols
GIT_PROMPT_SYMBOLS_AHEAD="${BoldBlue}  "
GIT_PROMPT_SYMBOLS_BEHIND="${BoldBlue}  "
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${DimBlueBg}${BoldBlue} ⁜ ${ResetColor}"
GIT_PROMPT_SYMBOLS_PREHASH=":"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment