Files
agent-skills/commands/merge.md
T
Miguel Palhas cc78bcef9c fix(merge): drop worktree cleanup step
The aoe-ownership check and its warning were noise on every merge; cleanup is the user's call.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 14:27:50 +01:00

1.7 KiB

Merge a branch from the worktree. If you're currently working on a worktree, assume that's the one I'm referring to.

Start by committing any staged and unstaged changes. I may have made changes to the worktree manually. Then merge back the new main branch, since I may have made changes to it.

Language specific:

Rust

Ensure cargo check is happy. Ensure clippy is happy. clean up any new warnings.

Typescript

Ensure tsc is happy.

Merging

Pick the forge before running anything:

  • remoteHost from .claude/tracker.json (or legacy .claude/linear.json) if set (github / gitea).
  • Else infer from git remote get-url origin: github.comgithub; anything else (e.g. git.naps.pt) → gitea.

Merge server-side when a PR exists, so the forge marks it "merged" and not "closed".

github:

gh pr merge --squash

gitea: there is no tea CLI on this machine — use the REST API. BASE is remoteBaseUrl from config (or the origin host), REPO is <owner>/<repo> from origin, $GITEA_TOKEN comes from the environment (source ~/.env.claude if missing). Header auth only — never put the token in a URL.

N=$(curl -sS -H "Authorization: token $GITEA_TOKEN" \
  "$BASE/api/v1/repos/$REPO/pulls?state=open&head=<owner>:<branch>" | jq -r '.[0].number')
curl -sS -X POST -H "Authorization: token $GITEA_TOKEN" -H "Content-Type: application/json" \
  "$BASE/api/v1/repos/$REPO/pulls/$N/merge" -d '{"Do":"squash"}'

No PR on either forge (the /yolo flow pushes without one): merge locally instead — checkout the default branch, git merge <branch> --no-edit, push.

Cleanup

None. Never remove the worktree or delete the branch, and never check who owns them — I handle cleanup myself. Report the merge and stop.