Customize bash in Mac terminal to show version control information

Highlights: I came across nice utility vcprompt which shows the git source control information in Mac OS bash terminal.

Steps:
Install vcprompt using brew
brew install vcprompt

Now Add this code in .bashrc file in your home directory
You can search for different colors and use those as variables with “$” prefix.
You can pass different format options for vcprompt -f flag.

NO_COLOR='\e[0m'
RED='\e[0;31m'
export PS1="\n\u:\w \[$RED\] \$(vcprompt -f [%b])\[$NO_COLOR\] \n→ "

Once you are done with above changes, either restart the terminal or run the command to load configuration file.

source ~/.bashrc

Result: Now You will see the project current branch and other information when you navigate to a folder which is under source control.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s