-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(scripts): 新增sync脚本,同步master到不同仓库
- Loading branch information
142vip.cn
committed
Nov 15, 2023
1 parent
b3ae3fc
commit 26d4f75
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
## | ||
## 同步分支脚本 | ||
## 使用: ./scripts/sync | ||
## | ||
|
||
|
||
# 远程仓库名称 | ||
remoteList=("mmdapl" "chufan443" "lir0115") | ||
# 获取当前分支名称 | ||
current_branch=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
|
||
# 判断分支名称 | ||
if [ "$current_branch" = "master" ]; then | ||
|
||
# 合并next分支内容到master分之 | ||
git merge origin/next | ||
|
||
# 推送到每个远程仓库 | ||
for repoName in "${remoteList[@]}" | ||
do | ||
echo "Pushing to $repoName..." | ||
git push "$repoName" master | ||
done | ||
else | ||
echo "当前分支是:$current_branch ,只允许在master分支上操作,并推送到远程!!!" | ||
fi |