Files
codex-permanent-memory/scripts/sync-to-github.ps1
T
2026-04-29 07:42:02 -05:00

34 lines
739 B
PowerShell

param(
[string]$Message = ""
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$git = "C:\Program Files\Git\cmd\git.exe"
if (-not (Test-Path $git)) {
throw "git.exe was not found at $git"
}
$branch = (& $git -C $repoRoot branch --show-current).Trim()
if (-not $branch) {
throw "No active git branch was found."
}
$status = & $git -C $repoRoot status --porcelain
if (-not $status) {
Write-Host "No changes to sync."
exit 0
}
if (-not $Message) {
$Message = "Permanent memory sync $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')"
}
& $git -C $repoRoot add -A
& $git -C $repoRoot commit -m $Message
& $git -C $repoRoot push origin $branch
Write-Host "Synced branch '$branch' to origin."