-
Notifications
You must be signed in to change notification settings - Fork 6
/
split.sh
41 lines (27 loc) · 941 Bytes
/
split.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
#!/usr/bin/env bash
set -e
CURRENT_BRANCH="master"
for REMOTE in auth cache config console database debug di encryption event filesystem http i18n kernel log page router server session support validate view
do
echo ""
echo ""
echo "Split $REMOTE";
TMP_DIR="./leevel-split"
REMOTE_URL="git@github.com:leevels/$REMOTE.git"
rm -rf $TMP_DIR;
mkdir $TMP_DIR;
(
SPLIT_NEW_BRANCH="split-tmp-branch"
REMOTE_DIR=$(echo ${REMOTE:0:1} | tr 'a-z' 'A-Z');
TMP_DIR_END=$(echo ${REMOTE:1});
REMOTE_DIR=${REMOTE_DIR}${TMP_DIR_END}
git subtree split -P "src/Leevel/$REMOTE_DIR" -b $SPLIT_NEW_BRANCH
cd $TMP_DIR;
git init --initial-branch=master;
git pull ../ $SPLIT_NEW_BRANCH
git push -f "git@github.com:leevels/$REMOTE.git" "master:$CURRENT_BRANCH"
cd -
git branch -D $SPLIT_NEW_BRANCH
rm -rf $TMP_DIR;
)
done