Files

23 lines
697 B
PowerShell

# waypoint.ps1
if (-not (Test-Path -Path ".\.git" -PathType Container)) {
Write-Host "No .git folder detected. Initializing new Git repository..." -ForegroundColor Yellow
git init
} else {
Write-Host "Git repository detected. Creating waypoint..." -ForegroundColor Cyan
}
# Stage all changes
git add .
# Format the timestamp with timezone offset/ID string
$timestamp = (Get-Date).ToString("yyyy-MM-dd-HHmm") + "-" + ((Get-TimeZone).Id -creplace '[a-z\s]', '')
# Capture current git status output
$statusOutput = (git status | Out-String).Trim()
# Construct the commit message
$commitMessage = "WAYPOINT $timestamp`n`n$statusOutput"
# Execute commit
git commit -m "$commitMessage"