How to go from this…
… to this?
We will be changing your
.bashrc file. It is located in your home.
- Make a save of your
.bashrcfile (one is never too careful;
cp -p .bashrc .bashrc.sav).
- Optional step: make your prompt colored by uncommenting the highlighted line:
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
- Now locate the last line of the following excerpt and edit the previous lines accordingly to the following line:
# Add git branch if its present to PS1
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
if [ "$color_prompt" = yes ]; then
unset color_prompt force_color_prompt
- Restart your prompt, you’re done.