Auto commit: 2025-12-21 22:45:00 - Hourly auto save

This commit is contained in:
Your Name committed 2025-12-21 22:45:01 +08:00
1 parent 1a63852bde
commit 5b8dd6e5d4
17 files changed
+1921 -88

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
# Git Auto Commit and Push Script
# Auto save, commit and push to GitHub every hour
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$ErrorActionPreference = "Stop"
# Switch to project directory
$projectPath = "C:\Users\12742\Desktop\douyin_guaji-main"
Set-Location $projectPath
# Get current timestamp
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Auto Commit Script Running: $timestamp" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
try {
# Check for changes
$status = git status --porcelain
if ($status) {
Write-Host "Changes detected, starting commit..." -ForegroundColor Yellow
# Add all modified files
git add -A
# Create commit message with timestamp
$commitMessage = "Auto commit: $timestamp - Hourly auto save"
git commit -m $commitMessage
Write-Host "Commit successful: $commitMessage" -ForegroundColor Green
# Push to GitHub
Write-Host "Pushing to GitHub..." -ForegroundColor Yellow
git push origin main
Write-Host "Push successful!" -ForegroundColor Green
} else {
Write-Host "No changes detected, skipping commit." -ForegroundColor Gray
}
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Script execution completed" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
} catch {
Write-Host "Error: $_" -ForegroundColor Red
Write-Host "Stack trace: $($_.ScriptStackTrace)" -ForegroundColor Red
exit 1
}