Skip to content

Commit 7ad9f29

Browse files
authored
feat(scripts): 新增sync脚本,同步master分支到不同仓库 (#111)
1 parent 605863a commit 7ad9f29

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

scripts/release

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ current_branch=$(git rev-parse --abbrev-ref HEAD)
1919
if [ "$current_branch" = "next" ]; then
2020
bumpp --preid alpha --execute="$generateChangeLog" --commit "$commitInfo" --all --tag --push
2121
else
22-
echo "当前分支是:$current_branch版本迭代允许在next分之操作,并推送到远程!!!"
22+
echo "当前分支是:$current_branch版本迭代允许在next分支操作,并推送到远程!!!"
2323
fi
2424

2525

scripts/sync

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
##
4+
## 同步分支脚本
5+
## 使用: ./scripts/sync
6+
##
7+
8+
9+
# 远程仓库名称
10+
remoteList=("origin" "mmdapl" "chufan443" "lir0115")
11+
# 获取当前分支名称
12+
current_branch=$(git rev-parse --abbrev-ref HEAD)
13+
14+
15+
# 判断分支名称
16+
if [ "$current_branch" = "master" ]; then
17+
18+
# 合并next分支内容到master分之
19+
git merge origin/next
20+
21+
# 推送到每个远程仓库
22+
for repoName in "${remoteList[@]}"
23+
do
24+
echo "Pushing to $repoName..."
25+
git push "$repoName" master
26+
done
27+
else
28+
echo "当前分支是:$current_branch ,只允许在master分支上操作,并推送到远程!!!"
29+
fi

0 commit comments

Comments
 (0)