Skip to content

Instantly share code, notes, and snippets.

@gaieges
Created August 1, 2017 15:36
Show Gist options
  • Save gaieges/7e05a6ab0c1d892c97be9cd5cd8dfb6e to your computer and use it in GitHub Desktop.
Save gaieges/7e05a6ab0c1d892c97be9cd5cd8dfb6e to your computer and use it in GitHub Desktop.
bash-git-prompt
# need brew package 'bash-git-prompt' for this to work
# brew install bash-git-prompt
# this is just my custom colorization, they have themes available too if you look at the git repo:
# https://github.com/magicmonty/bash-git-prompt
GIT_PROMPT_START="\[\033[0;33m\][\D{%m-%d} \t \!] \`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u@\h:\`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\[\033[0m\]"; echo -ne "\033]0;`hostname -s`:`pwd`\007"
GIT_PROMPT_END="\n\$ "
if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then
source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh"
fi
@gaieges
Copy link
Author

gaieges commented Aug 1, 2017

  • Install brew package
  • Drop the contents of this into ~/.bash_profile
  • run source ~/.bash_profile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment