/mg.sh
Shell | 29 lines | 22 code | 1 blank | 6 comment | 0 complexity | 5b62ded3ac08b9e151faa56e6f115bac MD5 | raw file
- #!/usr/bin/env sh
- # Requirements:
- # - parallel: GNU parallel
- # - git: Git
- # - rg: RipGrep from BurntSushi, needed for PCRE regexes
- case "$1" in
- st)
- parallel -k -a .repos --tag git -C {} status -s
- ;;
- pull)
- parallel -k -a .repos --tag git -C {} pull --ff-only --rebase=false
- ;;
- current-branch)
- parallel -k -a .repos --tag git -C {} rev-parse --abbrev-ref HEAD
- ;;
- outdated)
- # Show where the checked-out branch is out of date with the remote
- parallel -k -a .repos --tag "git -C {} status | rg -P \"Your branch is (?"'!'"up to date)\""
- ;;
- help|-h|--help)
- echo "Usage: $0 st|pull"
- exit 1
- ;;
- git)
- shift
- parallel -k -a .repos --tag git -C {} "$@"
- ;;
- esac