Git Workflow
This skill handles git operations securely using mutex locking for commits to prevent concurrency issues.
1. Commit Changes
Context
- •Locking: Uses
.git-commit.lockto ensure exclusive access. - •Scope: commits should only include files changed in the current task.
Instructions
- •
Acquire Lock:
powershell.\.agent\skills\git-workflow\scripts\acquire-commit-lock.ps1 if ($LASTEXITCODE -ne 0) { throw "Failed to acquire commit lock" } - •
Analyze Changes:
- •Verify status and diffs.
- •Stage ONLY relevant files (don't use
git add .).
- •
Execute Commit:
powershell# Single Line .\.agent\skills\git-workflow\scripts\execute-git-commit.ps1 -Files @("file1", "file2") -Message "Commit message." # Multi Line .\.agent\skills\git-workflow\scripts\execute-git-commit.ps1 -Files @("file1", "file2") -Message "Title" -AdditionalMessages @("Details")
2. Sync with Remote
Instructions
- •Check State:
git status,git log - •Pre-Sync: Ensure clean working tree (commit or stash).
- •Fetch & Pull:
powershell
git fetch origin git pull --rebase origin main
- •Push:
powershell
git push origin main
- •Combined (Quick):
powershell
git fetch origin && git pull --rebase origin main && git push origin main