Git terminal prompt on a mac

Assuming you’re setting up on a shiny new mac, here is how you can add the git branch to the command prompt:

Grab these files and add them to the ~/ folder

Also then add a .bash_profile to that folder, easiest way is to open the terminal at that folder then use the touch command:

touch .bash_profile

Then add these lines to the file:

source ~/.git-completion.bash
source ~/
export PS1='[\W$(__git_ps1 ” (%s)”)]\$ ‘

Restart the terminal and you’re done!

Leave a Reply

Your email address will not be published. Required fields are marked *