Ollie Saunders Ollie Saunders - 5 months ago 28
Git Question

Show just the current branch in Git

I tried looking for a special git command for this but couldn't find one. Can anyone suggest anything shorter or faster than:

git branch | awk '/\*/ { print $2; }'

Answer Source
$ git rev-parse --abbrev-ref HEAD

This should work with Git 1.6.3 or newer.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download