This article explains how I set up my new Mac’s terminal to be more simple and incorporate the Git branch in the prompt.
Get .git-promt.sh
Get the code from the source on GitHub.
As directed in the comments, place the code in your home directory (e.g. ~/.git-prompt.sh
). You will most likely need to create this file.
Add or edit .bashrc or .zshrc
You will need to know what shell you are running. A really easy way to see this is to just type some gibberish in the terminal prompt and hit enter.
The above shows you are running the Bash shell. Below shows you are using the ZSH shell.
Create or edit your .bashrc or .zshrc file in your home directory (e.g. ~/.zshrc). Then add the following to your file and save:
Bash Shell
ZSH Shell
Reload Shell rc File
Run the following command to reload your RC file.
Bash Shell
ZSH Shell
Your New Prompt
Your new prompt will look something like this depending on if you are in a git repository or not:
There are many options to customize your prompt even more by customizing what you put in your RC file. Doing a search on google will help you find what you need.