Show Git Branch in Command Prompt (Ubuntu)

January 27, 2019


cd ~
wget -O

Edit .bashrc

nano ~/.bashrc

Add the following at the end of the file

source ~/
PS1='[\u@\h:\w$(__git_ps1 " (%s)")]\$ '

NOTE: You can customize the bash prompt/PS1.

Start a new command prompt or run

source .bashrc

NOTE: You might want to look into bash-git-prompt for a more fancy bash prompt for git.

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.