feat: 在同步仓库脚本中添加自动合并消息功能,优化合并流程

This commit is contained in:
xudan 2025-06-18 08:59:12 +08:00
parent 007c4f1431
commit 75b46c846f

View File

@ -74,14 +74,19 @@ function Sync-Repositories {
} else {
Write-ColorOutput "正在使用merge合并代码..." "Green"
if (-not $DryRun) {
git merge upstream/master
# 生成自动合并消息
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$mergeMessage = "feat: 同步上游仓库更新 ($timestamp)"
git merge upstream/master --no-edit -m $mergeMessage
if ($LASTEXITCODE -ne 0) {
Write-ColorOutput "Merge失败请手动解决冲突后再继续。" "Red"
Write-ColorOutput "解决冲突后请运行: git commit" "Yellow"
return
}
Write-ColorOutput "使用自动合并消息: $mergeMessage" "Gray"
} else {
Write-ColorOutput "[预览模式] git merge upstream/master" "Gray"
Write-ColorOutput "[预览模式] git merge upstream/master --no-edit -m '自动合并消息'" "Gray"
}
}