Highlights: I came across nice utility vcprompt which shows the git source control information in Mac OS bash terminal.
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.
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.
Result: Now You will see the project current branch and other information when you navigate to a folder which is under source control.
Requirement: it would be great to get autocompletion for git commands in mac terminal.
Install Git download
Now we need to download bash file with all commands. Open terminal and run this command from Home directory.
curl -O https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash .git-completion.bash
Now check for .bash_profile in your home directory. open terminal
This command should show all invisible file also.
Create file .bash_profile if it doesn’t exist.
Open file .bash_profile in text editor or editor of your choice.
Now append this code for .bash_profile file.
if [ -f ~/.git-completion.bash ]; then
Save it and close the terminal.
Open the terminal.
type > git h
This should complete command as “git help”
You can get completion for git command options also.
git log –a
this should list all possible options start with “–a”.