So obviously, this blog will be more of a notebook to me than it is an actual Blog. And just so we get things started, Here’s that…
A note before we get started with the steps, The following steps where implemented and tested on a macOS machine. I assume the differences to the other OS will be mainly in the file paths.
Download files from:
you need to have those files on you computer in the HOME directory.
if you decided to place those files elsewhere, make sure to update the the script accordingly.
if [ -f ~/.git-completion.bash ]; then . ~/.git-completion.bash fi if [ -f ~/.git-prompt.sh ]; then . ~/.git-prompt.sh fi WHITE="\[\033[1;37m\]" MAGENTA="\[\033[0;35m\]" YELLOW="\[\033[0;33m\]" BLUE="\[\033[34m\]" LIGHT_GRAY="\[\033[0;37m\]" CYAN="\[\033[0;36m\]" GREEN="\[\033[0;32m\]" RED="\[\033[0;31m\]" GIT_PS1_SHOWDIRTYSTATE=true export LS_OPTIONS='--color=auto' export CLICOLOR='Yes' export LSCOLORS=gxfxbEaEBxxEhEhBaDaCaD export PS1=$LIGHT_GRAY"\W"'$( if [[ $(__git_ps1) =~ \*\)$ ]] # a file has been modified but not added then echo "'$YELLOW'"$(__git_ps1 " (%s)") elif [[ $(__git_ps1) =~ \+\)$ ]] # a file has been added, but not commited then echo "'$MAGENTA'"$(__git_ps1 " (%s)") # the state is clean, changes are commited else echo "'$RED'"$(__git_ps1 " (%s)") fi)'$WHITE"$ "
if you wanted to use different colors other than the ones provided above. Visit this link
once you add that script to ~_.bash_profile
you’ll just need to either restart the terminal for the changes to take effect completely or run
. ~_.bash_profile to every session you have open
Finally, I can’t claim authorship to the code presented above, I found this note deep down in my old notes and I think that the starting code to this was found somewhere on StackOverflow. I will share the source as soon as I get a handle of it.