nb_repos_status() {
shell_help "List repos git status" "$@" && return
- local status
-# NB 26.01.18 local pwd=`pwd`
- local i
+ local status i branch
local ret=0
+ local sav_pwd=${PWD:-$(pwd)}
for i in $(nb_repos); do
-# NB 26.01.18 cd "$i" || continue
+ cd "$i" || continue
- status=$(cd "$i" && git status --short "$i"|sed 's/^/ /') || continue
+ for branch in $(git branch | sed -E 's/^[\* ]+//'); do
+ status=$(git status --short --branch "$branch"|grep -v '^#'|sed 's/^/ /') || continue
[ -n "$status" ] && status=$'\n'"$status" && ret=1
- printf "%s %s\n" "$i" "$status"
+ printf "%s %s\n" "$i [$branch]" "$status"
+ done
done
-# NB 26.01.18 cd "$pwd"
+ cd "$sav_pwd"
return $ret
}