| name | commit-push-task |
| description | Commit changes on the worktree branch, fast-forward merge into the task branch, and push the task branch |
| user-invocable | true |
Commit any pending changes on the current worktree branch, fast-forward merge them into the task branch, then push the task branch to origin. Never push the worktree branch.
The session's startup system reminder identifies:
- "Task branch: " — the branch to merge into and push
- "Worktree branch: " — the current branch you are on
If those lines are not present, abort and ask the user for the task branch name.
Steps
-
Determine the worktree path. The current working directory is a git worktree.
-
Check for uncommitted changes:
git status --porcelain
If there are changes, stage and commit them on the current (worktree) branch:
git add -A
git commit -m "<short message describing the change>"
Choose a concise, conventional commit message based on the diff. Do NOT include any "Generated by" / co-author trailers.
-
Confirm the current branch matches the worktree branch from the system reminder:
git rev-parse --abbrev-ref HEAD
If it does not match, abort and report the mismatch.
-
Locate the main project repository (not the worktree). Use:
git worktree list
The first entry (or the one not marked as the current worktree) is the main repository path. Run all subsequent task-branch operations there with git -C <main-repo-path> ....
-
Fast-forward merge the worktree branch into the task branch in the main repo:
git -C <main-repo-path> fetch . <worktree-branch>:<task-branch>
The fetch . src:dst form performs a fast-forward update of <task-branch> to <worktree-branch>. It refuses to run if the merge would not be fast-forward.
If the fast-forward fails because the task branch has diverged:
- Default (non-stacked tasks): abort and report. Do NOT force, rebase, or merge non-ff without explicit user confirmation.
- Stacked-PR tasks (see the
stacked-pr skill): divergence is expected — publishing the stack rewrites the task branch history (git spr rebases onto trunk + adds commit-id: trailers), so a worktree forked before the last publish no longer fast-forwards. Recover by rebasing the worktree's new commits onto the task tip, then fast-forwarding:
# on the worktree branch, in the worktree:
git fetch <main-repo-path> <task-branch>
git rebase FETCH_HEAD # replays only the worktree's new commits onto the task tip
# resolve any conflicts (git add → git rebase --continue), then ff as above:
git -C <main-repo-path> fetch . <worktree-branch>:<task-branch>
This replays just the worktree's unique commits, so the ff then succeeds. Only do this for stacked tasks or when the user confirms.
-
Push only the task branch:
git -C <main-repo-path> push origin <task-branch>
Do NOT push the worktree branch. Do NOT use --force or --force-with-lease unless the user explicitly asks.
-
Report a one-line summary: commit SHA (if a new commit was made), task branch updated to that SHA, and push result.
Edge cases
- Nothing to commit and task branch already at worktree HEAD: skip commit and merge, still attempt push (it will be a no-op or report "Everything up-to-date").
- Task branch is the same as worktree branch (no worktree): just commit and push the task branch directly.
- Pre-commit hook fails: do NOT use
--no-verify. Report the failure and stop.