Skip to content

Commit

Permalink
feat(scripts): 新增sync脚本,同步master分支到不同仓库 (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmdapl committed Nov 15, 2023
1 parent 605863a commit 7ad9f29
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/release
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" = "next" ]; then
bumpp --preid alpha --execute="$generateChangeLog" --commit "$commitInfo" --all --tag --push
else
echo "当前分支是:$current_branch版本迭代允许在next分之操作,并推送到远程!!!"
echo "当前分支是:$current_branch版本迭代允许在next分支操作,并推送到远程!!!"
fi


Expand Down
29 changes: 29 additions & 0 deletions scripts/sync
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

##
## 同步分支脚本
## 使用: ./scripts/sync
##


# 远程仓库名称
remoteList=("origin" "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

0 comments on commit 7ad9f29

Please sign in to comment.