Linux   Linux – Show git branch in bash prompt



If you are a Git user, you can find very useful this custom prompt.

Branch

Shows working branch when it detects the current folder is a git one:

user1@labdebian ~/data $
user1@labdebian ~/data $ cd ../myproject/
user1@labdebian ~/myproject (master) $
user1@labdebian ~/myproject (master) $ git checkout -b branch1
Switched to a new branch 'branch1'
user1@labdebian ~/myproject (branch1) $
user1@labdebian ~/myproject
Read more