2 # git-which-branch.sh - output the name of the current git branch
4 # The canonical location of this program is the telepathy-spec tools/
5 # directory, please synchronize any changes with that copy.
7 # Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
9 # Copying and distribution of this file, with or without modification,
10 # are permitted in any medium without royalty provided the copyright
11 # notice and this notice are preserved.
14 if { ref
="`git symbolic-ref HEAD 2>/dev/null`"; }; then
15 echo ${ref#refs/heads/}
19 if test -n "$default"; then
20 echo "$default" >/dev
/null
24 echo "no git branch found" >&2