#!/bin/bash g() { git "$@"; } cmd=$1 shift acmd=$(git config --get "alias.${cmd}") case ${acmd} in rebase) if [[ $1 == "all" ]] ; then shift branches=$(g b | awk ' { if ($0 ~ "^[*] *[(]no branch[)]") { next } else if ($1 == "*") { b = $NF } else { list = list $NF " " } } END { print list b }') for b in ${branches} ; do echo " ### $b" g co $b || exit 1 r rb "$@" || exit 1 done exit 0 fi ;; esac exec repo ${acmd:-${cmd}} "$@"