<< All Posts

Show your git branch on your bash$ line

How to show my branch on my command line interface? Here you can find a simple example that I’m using on my Ubuntu Desktop computer. The first thing that you have to do is edit your .bashrc file. It is located on your home folder. Just type:

cd ~

And than, you can edit your file just using your favorite editor. I’m using vim. Here are some tips to edit your file using vim if you haven’t used before:

vim .bashrc
ESC + i   (That's enable the insert mode)
ESC + x  (That's save and quit from vim)

Edit your .bashrc and put this in the end of the file:``

# http://blog.blakesimpson.co.uk/read/29-show-git-branch-and-directory-in-your-shell
export PS1='\[\033[1;36m\]\u at\[\033[00m\] \[\033[34m\]\W\[\033[31m\]$("__git_ps1")\[\033[00m\] > '

Just save and reload your configuration.

sudo sh .bashrc

Hope you enjoy!  I’m gonna create a post about git soon. A lot of tips! Stay tuned!

<< All Posts


🇧🇷 🇨🇦
Runs on OpenBSD 🐡