You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: home/dot_config/opencode/skills/git-commit-push/SKILL.md
+34-8Lines changed: 34 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: git-commit-push
3
-
description: Execute a safe commit-and-push workflow with parallel git context checks, GitHub CLI credential diagnostics, and non-fast-forward rebase remediation. Use when the user asks to commit and push changes.
3
+
description: Execute a safe commit-and-push workflow with parallel git context checks, cross-shell-safe commit message handling, and non-fast-forward remediation. Use when the user asks to commit and push changes.
4
4
---
5
5
6
6
## Goal
@@ -10,7 +10,7 @@ Capture the exact workflow for commit and push requests:
10
10
1. Run three repo-inspection commands in parallel.
11
11
2. Commit with a message that matches repo style.
12
12
3. Push.
13
-
4. If auth fails, run two diagnostics in parallel and retry push with `gh` credential helper.
13
+
4. If auth fails, run two diagnostics in parallel and retry push with a `mise x -- gh` credential helper.
14
14
5. If non-fast-forward, rebase onto `origin/main` and push again.
15
15
16
16
## Step 1, run three parallel checks
@@ -29,7 +29,7 @@ Use the outputs to:
29
29
30
30
## Step 2, stage and commit
31
31
32
-
Stage intended files and commit using a heredoc message.
32
+
Stage intended files and commit using a shell-safe multiline message strategy.
33
33
34
34
Template:
35
35
@@ -42,6 +42,23 @@ EOF
42
42
)"
43
43
```
44
44
45
+
Windows and mixed-shell rule:
46
+
47
+
- If command execution is wrapped by PowerShell, do not use bash heredoc directly.
48
+
- Use a PowerShell here-string for multiline messages:
49
+
50
+
```powershell
51
+
$msg = @'
52
+
<type>(<scope>): <short why-focused subject>
53
+
54
+
<1-2 sentence rationale>
55
+
'@
56
+
git add -A
57
+
git commit -m $msg
58
+
```
59
+
60
+
- If you do use bash heredoc, invoke through `bash -lc` and keep all heredoc content inside that single bash command.
61
+
45
62
After commit, verify:
46
63
47
64
-`git status --short --branch`
@@ -61,21 +78,21 @@ If push fails with credential/auth errors, run these in parallel:
61
78
62
79
Then retry push with one-off helper (do not change global git config):
@@ -87,4 +104,13 @@ If push is rejected with `fetch first` or non-fast-forward:
87
104
88
105
## Self-improvement loop
89
106
90
-
After each use, if any command order, diagnostics, or remediation step can be improved, update this skill in chezmoi source (`home/dot_config/opencode/skills/git-commit-push/SKILL.md`) and keep the workflow current.
107
+
After each use, run this loop before ending the task:
0 commit comments