Following Eran’s post on showing current git branch, here is an improved version including branch or tag number (which is helpful in repositories like nodejs) .

in order to differentiate between branches and tags the script prints branches in braces () and tags in square braces [].
[gist id=988852]