Files
liars-bar-game/scripts/commit_current.ps1
T

29 lines
1019 B
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 一鍵:暫存本次所有修改並 commit(需在一般終端機、具 .git 寫入權限)
# 用法:powershell -ExecutionPolicy Bypass -File scripts\commit_current.ps1
$ErrorActionPreference = 'Stop'
Set-Location (Join-Path $PSScriptRoot '..')
# 載入 runtime git(若尚未在 PATH
$git = Get-Command git -ErrorAction SilentlyContinue
if (-not $git) {
$runtimeGit = 'C:\Users\ckliu\.cache\codex-runtimes\codex-primary-runtime\dependencies\native\git\cmd\git.exe'
if (Test-Path $runtimeGit) { $gitCmd = $runtimeGit } else { throw '找不到 git' }
} else { $gitCmd = $git.Source }
Write-Host '== 確認待 commit 內容 =='
& $gitCmd status --short
Write-Host ''
Write-Host '== git add -A =='
& $gitCmd add -A
if ($LASTEXITCODE -ne 0) { throw 'git add 失敗' }
Write-Host ''
Write-Host '== git commit =='
& $gitCmd commit -m "Fix info leak in web game + add handover notes"
if ($LASTEXITCODE -ne 0) { throw 'git commit 失敗' }
Write-Host ''
Write-Host '== 完成 =='
& $gitCmd log --oneline -1