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
if [ -f ~/.git-prompt.sh ]; then
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)")
if you wanted to use different colors other than the ones provided above. Visit this link
once you add that script to ~.bash_profileyou’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.