aboutsummaryrefslogtreecommitdiff
path: root/templates/.zsh/functions/git-branches.zsh
blob: 4636cab6c6fe274dce5cfdc41a45cd356aaeb46c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
green=`tput setaf 2`
reset=`tput sgr0`

git-branches() {
  set -f
  git branch | while read line; do
    current="  "
    name=${line##\* }   ## removes leading * for current

    if [ ! "$name" = "$line" ]; then
      current="${green}* "
    fi

    description=`git config "branch.$name.description"`

    if [ "$description" != "" ]; then
      description=" : $description"
    fi

    echo "${reset}${current}${name}${description}${reset}"
  done
  set +f
}