File tree 1 file changed +7
-8
lines changed 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -68,21 +68,20 @@ jobs:
68
68
git fetch upstream ${{ inputs.upstream_sync_branch }}:temp_${{ inputs.upstream_sync_branch }}
69
69
# 基于临时分支创建新的本地分支
70
70
git checkout -b ${{ inputs.target_sync_branch }} temp_${{ inputs.upstream_sync_branch }}
71
- # 删除临时分支
72
- git branch -d temp_${{ inputs.upstream_sync_branch }}
71
+ # 强制删除临时分支,没必要
72
+ # git branch -D temp_${{ inputs.upstream_sync_branch }}
73
73
# 推送新分支到远程仓库
74
74
git push origin ${{ inputs.target_sync_branch }}
75
75
else
76
76
echo "branch_exists=true" >> $GITHUB_OUTPUT
77
77
echo "Remote branch ${{ inputs.target_sync_branch }} exists."
78
78
# 创建一个临时分支来fetch远程分支的内容
79
79
git fetch upstream ${{ inputs.upstream_sync_branch }}:temp_${{ inputs.upstream_sync_branch }}
80
- # 这里使用了 git branch -f 来强制更新 target_sync_branch 分支的指向,然后切换到该分支。这将会丢弃 target_sync_branch 分支上所有未合并的更改。
81
- git branch -D ${{ inputs.target_sync_branch }} # 强制删除本地分支
82
- git branch -f ${{ inputs.target_sync_branch }} temp_${{ inputs.upstream_sync_branch }}
83
- git checkout ${{ inputs.target_sync_branch }}
84
- # 删除临时分支
85
- git branch -d temp_${{ inputs.upstream_sync_branch }}
80
+ ggit checkout ${{ inputs.target_sync_branch }}
81
+ # 合并,使用传入解决合并冲突
82
+ git merge --strategy-option theirs temp_${{ inputs.upstream_sync_branch }}
83
+ # 强制删除临时分支,没必要
84
+ # git branch -D temp_${{ inputs.upstream_sync_branch }}
86
85
# 推送新分支到远程仓库
87
86
git push origin ${{ inputs.target_sync_branch }}
88
87
fi
You can’t perform that action at this time.
0 commit comments