-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathcreate-branch.sh
44 lines (40 loc) · 1.14 KB
/
create-branch.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
#!/bin/bash
which git >/dev/null || { echo "Could not find git on this machine. Install git and try again.";exit 1; }
gitid=$1
branch=$2
if [[ -z $gitid || -z $branch ]]; then
echo "Missing args.\nUsage: sh create-branch.sh <git-account> <branch-name-to-create>"
exit 1
fi
base_url="http://github.com/$gitid/"
wdir=/tmp/`/bin/date +'%H%M%S'`
mkdir -p $wdir
cat > $wdir/repo.list <<EOF
refarch-cloudnative
refarch-cloudnative-bff-inventory
refarch-cloudnative-bff-socialreview
refarch-cloudnative-micro-inventory
refarch-cloudnative-micro-socialreview
refarch-cloudnative-netflix-eureka
refarch-cloudnative-netflix-zuul
refarch-cloudnative-devops
refarch-cloudnative-api
refarch-cloudnative-auth
refarch-cloudnative-bluecompute-mobile
refarch-cloudnative-bluecompute-web
refarch-cloudnative-mysql
refarch-cloudnative-csmo
refarch-cloudnative-resiliency
refarch-cloudnative-performance
EOF
while read repo; do
echo "\ncreating branch:$branch in $base_url$repo"
pushd $wdir >/dev/null
git clone $base_url$repo
cd $repo
git checkout -b $branch
git push origin $branch
popd >/dev/null
done < $wdir/repo.list
rm -rf $wdir
exit 0