darkrc/bin/git-push-pending

17 lines
583 B
Bash
Executable File

#!/bin/sh
repositories=$(git-pending "$@" \
| grep '^ahead' \
| lua -e 'for line in io.lines() do print(line:match("[^/]+$")); print((line:gsub("^[^ ]* ", ""))) end' \
)
if [ -z "$repositories" ]
then
notify-send Git "No pending repositories"
exit
fi
echo "$repositories" \
| zenity --list --column Repository --column Path --text "Repositories that need pushing:" --multiple --title "Git" --separator ';' --width 800 --height 300 --print-column=2 2>/dev/null \
| tr ';' '\n' \
| xargs -P`nproc` -L 1 -I€ sh -c 'cd € && git push'
notify-send Git 'Pushed everything 🎉'