mirror of
https://github.com/myronblair/codex-permanent-memory
synced 2026-06-30 17:50:55 -05:00
34 lines
739 B
PowerShell
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."
|