Commit 0af7e879 authored by huasheng's avatar huasheng

添加新工具

parents
#!/usr/bin/env bash
#
target_branch=$1
need_push_after_update=$2
#if [ -z "$target_branch" ] || [ "$target_branch" != "develop" -a "$target_branch" != "master" ]
if [ -z "$target_branch" ]
then
target_branch="develop"
fi
current_branch=$(git branch | grep '*' | awk '{print $2}')
git pull origin $current_branch
if [ $? -ne 0 ]
then
echo "***********************************"
echo "当前分支 "$current_branch" 拉取失败"
echo "***********************************"
exit
else
echo "==================================="
echo "当前分支 "$current_branch" 拉取成功"
echo "==================================="
fi
git push origin $current_branch
if [ $? -ne 0 ]
then
echo "***********************************"
echo "当前分支 "$current_branch" 推送失败"
echo "***********************************"
exit
else
echo "==================================="
echo "当前分支 "$current_branch" 推送成功"
echo "==================================="
fi
git checkout $target_branch
if [ $? -ne 0 ]
then
echo "**********************************"
echo "目标分支 "$target_branch" 切换失败"
echo "**********************************"
exit
else
echo "==================================="
echo "成功切换到目标分支 "$target_branch
echo "==================================="
fi
git pull origin $target_branch
if [ $? -ne 0 ]
then
echo "**********************************"
echo "目标分支 "$target_branch" 拉取失败"
echo "**********************************"
exit
else
echo "==================================="
echo "目标分支 "$target_branch" 拉取成功"
echo "==================================="
fi
git merge $current_branch
if [ $? -ne 0 ]
then
echo "********"
echo "合并失败"
echo "********"
exit
else
echo "========"
echo "合并成功"
echo "========"
fi
git checkout $current_branch
if [ $need_push_after_update -eq 1 ]
then
git push origin $target_branch
if [ $? -ne 0 ]
then
echo "**********************************"
echo "目标分支 "$target_branch" 推送失败"
echo "**********************************"
else
echo "=================================="
echo "目标分支 "$target_branch" 推送成功"
echo "=================================="
fi
fi
echo "===================================="
echo "向目标分支 "$target_branch" 合并完成"
echo "===================================="
#!/usr/bin/env bash
#
merge_request_comment=$1
if [ -z "$merge_request_comment" ]
then
echo "请对此次Merge Request操作编写相关描述\n"
exit
fi
current_branch=$(git branch | grep '*' | awk '{print $2}')
merge_temp_branch=$current_branch"_merge"
git checkout master && git pull origin master && git checkout -b $merge_temp_branch && git merge --squash $current_branch && git commit -m $merge_request_comment && git push origin $merge_temp_branch && git checkout $current_branch && git branch -D $merge_temp_branch
if [ $? -ne 0 ]
then
echo "***************************"
echo "合并失败,请处理后自行处理"
echo "***************************"
exit
else
echo "===================================="
echo "合并成功,请移步GitLab平台继续操作~"
echo "===================================="
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment