-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
upstreamAllRepos.sh
56 lines (47 loc) · 1005 Bytes
/
upstreamAllRepos.sh
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
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
clear
echo "-------- Update all repos! --------------"
# Edit these directories with the ones you want to update
repositories=('bob'
'browser-compat-data'
'content'
'css-examples'
'infra'
'interactive-examples'
'kuma'
'kumascript'
'learning-area'
'mdn-dinocons'
'mdn-minimalist'
'yari'
);
# repos that have 'main' branch (rather than 'master')
mainBranch=(
'content'
'mdn-dinocons'
'yari'
'mdn-minimalist'
)
# Edit this to your parent directory's path
SYSTEM_DIR=~/owd
branch=''
path=''
for i in "${repositories[@]}"
do
path="${SYSTEM_DIR}/$i"
cd ${path}
#check if the repo has a default 'main branch'
if [[ ${mainBranch[*]} =~ $i ]]
then
branch='main'
else
branch='master'
fi
echo "branch: " ${branch}
git fetch upstream
git checkout ${branch}
git merge upstream/${branch}
git push origin ${branch}
done
# if you like your computer to talk to you
# say "Mission Accomplished"