-
Notifications
You must be signed in to change notification settings - Fork 2
/
mgit
executable file
·46 lines (42 loc) · 1.2 KB
/
mgit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#! /bin/bash
repos="frontend matematikk-mooc.github.io mmooc-docker-postgresql mmooc-docker-redis mmooc-docker-canvas canvas-lms mmooc-docker-haproxy mmooc-docker-tools mmooc-docker-dev"
all_repos=". $repos"
case $1 in
clone)
for X in $repos; do
if ! [ -e $X ]; then
git clone [email protected]:matematikk-mooc/$X.git
fi
done
cd canvas-lms
if ! git remote | grep -q upstream; then
git remote add upstream [email protected]:instructure/canvas-lms.git
fi
cd -
;;
each)
for X in $all_repos; do
cd $X
if [ -n "$(git status --porcelain)" ]; then
git status -s
env PS1="$X> " bash --noprofile --norc
fi
cd -
done
;;
help)
cat <<EOF
Usage: ./mgit COMMAND
Commands:
(no command) Call git with the given arguments on all repos
clone Clone all repos from Github/matematikk-mooc
each Run a subshell in each folder that have uncommited changes
EOF
;;
*)
for X in $all_repos; do
echo Entering $X
(cd $X && git "$@")
done
;;
esac