Files
lcbp3/2git.ps1
admin 9e8bd25e1d
Some checks failed
Spec Validation / validate-markdown (push) Has been cancelled
Spec Validation / validate-diagrams (push) Has been cancelled
Spec Validation / check-todos (push) Has been cancelled
260130:1446 Update Infrastructure
2026-01-30 14:46:06 +07:00

38 lines
878 B
PowerShell

param([string]$Message = "Backup")
$Timestamp = Get-Date -Format "yyMMdd:HHmm"
$CommitMsg = "$Timestamp $Message"
Write-Host "📦 $CommitMsg" -ForegroundColor Cyan
git add .
# Check if anything to commit
$status = git status --porcelain
if (-not $status) {
Write-Host "⚠️ Nothing to commit" -ForegroundColor Yellow
pause
exit
}
git commit -m $CommitMsg
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Commit failed" -ForegroundColor Red
pause
exit 1
}
Write-Host "🚀 Pushing to Gitea..." -ForegroundColor Cyan
git push origin main
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Push to Gitea failed" -ForegroundColor Red
}
Write-Host "🚀 Pushing to GitHub..." -ForegroundColor Cyan
git push github main
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Push to GitHub failed" -ForegroundColor Red
}
Write-Host "✅ Done!" -ForegroundColor Green