Update a protected branch in its worktree by pulling latest changes. Handle merge conflicts by returning control to main agent for user coordination.
Safely updates protected branches (main, develop, master) in their worktrees by pulling latest changes. Returns control to caller for user coordination if merge conflicts occur.
/plugin marketplace add randlee/synaptic-canvas/plugin install sc-git-worktree@synaptic-canvassonnetThis agent is invoked via the Claude Task tool by a skill or command. Do not invoke directly.
Safely update protected branches (main, develop, master) in their worktrees by pulling latest changes from remote. Return control to caller if merge conflicts occur.
<worktree_base>/<branch>)../{{REPO_NAME}}-worktrees<worktree_base>/worktree-tracking.md when tracking is enabledbranch provided: target = [branch]; verify it is in protected_branches or return error.branch omitted: target = protected_branches (only those with existing worktrees at expected path).git status --short; if dirty, stop and report for that branch.git fetch origin <branch>.git pull origin <branch>.git diff --name-only --diff-filter=Ugit status --shortgit rev-list --count HEAD@{1}..HEAD (if HEAD moved)Return fenced JSON with minimal envelope:
```json
{
"success": true,
"data": {
"action": "update",
"branch": "main",
"path": "../repo-worktrees/main",
"commits_pulled": 5,
"old_commit": "abc1234",
"new_commit": "def5678",
"tracking_update": "last_checked updated"
},
"error": null
}
```
```json
{
"success": true,
"data": {
"action": "update",
"branch": "main",
"path": "../repo-worktrees/main",
"commits_pulled": 0,
"old_commit": "abc1234",
"new_commit": "abc1234",
"message": "already up to date",
"tracking_update": "last_checked updated"
},
"error": null
}
```
```json
{
"success": false,
"data": null,
"error": {
"code": "merge.conflicts",
"message": "merge conflicts detected during pull",
"conflicted_files": [
"src/foo.cs",
"src/bar.cs"
],
"worktree_path": "../repo-worktrees/main",
"recoverable": true,
"suggested_action": "Resolve conflicts in worktree at '../repo-worktrees/main', then commit the resolution. Run 'git status' to see conflict details."
}
}
```
```json
{
"success": false,
"data": null,
"error": {
"code": "branch.not_protected",
"message": "branch 'feature-x' is not a protected branch",
"recoverable": false,
"suggested_action": "Use --cleanup or --abort for non-protected branches. --update is only for protected branches like main, develop, master."
}
}
```
```json
{
"success": false,
"data": null,
"error": {
"code": "worktree.dirty",
"message": "worktree has uncommitted changes",
"dirty_files": [
" M src/modified.cs",
"?? src/untracked.txt"
],
"recoverable": true,
"suggested_action": "Commit or stash changes in worktree before updating"
}
}
```
```json
{
"success": true,
"data": {
"action": "update",
"results": {
"main": {"commits_pulled": 3, "status": "updated"},
"develop": {"commits_pulled": 0, "status": "up_to_date"}
},
"conflicts": {},
"tracking_update": "last_checked updated"
},
"error": null
}
```
You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.