From be3b71007a60c9418b57aef2168622f2a7214d2a Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 6 Dec 2025 16:05:28 +0700 Subject: [PATCH] 251206:1605 docs: update README and patch 2git.ps1 --- 2git.ps1 | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/2git.ps1 b/2git.ps1 index 7f300fd..4afadab 100644 --- a/2git.ps1 +++ b/2git.ps1 @@ -1,14 +1,38 @@ param([string]$Message = "Backup") -$Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" -$CommitMsg = "Backup: $Message | $Timestamp" +$Timestamp = Get-Date -Format "yyMMdd:HHmm" +$CommitMsg = "$Timestamp $Message" -Write-Host "Backup: $CommitMsg" -ForegroundColor Cyan +Write-Host "📦 $CommitMsg" -ForegroundColor Cyan git add . -git commit -m $CommitMsg -git push origin main -git push github main -Write-Host "Done!" -ForegroundColor Green +# 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 pause