Careful merge of the remote base branch into the current feature branch. Use when the user wants to sync their branch with main/master, merge upstream changes, update from base, or rebase-via-merge. Also use when the user says "merge base", "pull from main", "sync with main", "update branch", or any variation of incorporating base branch changes into the current working branch.
Merge the remote base branch into the current feature branch: pre-merge analysis, intelligent conflict resolution, behavioral change report.
Output philosophy: be concise — summaries, not diffs or source code. Never dump raw diffs, full file contents, or initial state unless explicitly requested; the user will ask for details.
Fetch all remotes and pull tracked branch changes (merge mode, never rebase).
CURRENT_BRANCH=$(git branch --show-current)
TRACKING=$(git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "")
git fetch --all --prune
if [ -n "$TRACKING" ]; then
git pull --no-rebase
fi
If the pull produces conflicts, resolve them (see Phase 4) before continuing.
From PR metadata, using the git-and-github skill:
BASE_BRANCH=$(gh pr view --json baseRefName -q .baseRefName 2>/dev/null)
If no PR exists, fall back to the repo default branch:
BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
If neither works, ask the user.
Merge from origin/$BASE_BRANCH (the remote-tracking ref, already updated by fetch) — not the local base branch, which may be stale.
Read diffs and logs internally to build context for conflict resolution and behavioral analysis (per Output philosophy — no diff/source output).
MERGE_BASE=$(git merge-base origin/$BASE_BRANCH HEAD)
# Our changes
git log --oneline $MERGE_BASE..HEAD
git diff --stat $MERGE_BASE..HEAD
git diff $MERGE_BASE..HEAD
# Their changes
git log --oneline $MERGE_BASE..origin/$BASE_BRANCH
git diff --stat $MERGE_BASE..origin/$BASE_BRANCH
git diff $MERGE_BASE..origin/$BASE_BRANCH
Identify files modified on both sides:
comm -12 \
<(git diff --name-only $MERGE_BASE..HEAD | sort) \
<(git diff --name-only $MERGE_BASE..origin/$BASE_BRANCH | sort)
Also find semantic overlaps — no textual conflict but behavior changes (e.g., upstream changed a function signature or default value that local code relies on).
Report a brief summary to the user:
git merge origin/$BASE_BRANCH --no-edit
The merge commits automatically. Proceed to Phase 5.
For each conflicted file:
git add <file>| Area | Ours | Theirs | Resolution |
|---|---|---|---|
| function_name() | Added X | Changed Y | Combined: X + Y |
Ask for approval before continuing. After all conflicts are resolved and approved:
git commit --no-edit
If the user rejects a resolution, apply their feedback and re-present.
The most important deliverable. Analyze the merge result for anything that could change runtime behavior — read merged files internally, no diff dumps.
Assign an overall Risk Factor (0-100%) — likelihood the merge introduced unintended behavioral changes:
For conflicted files and files flagged under "Changes Requiring Attention", identify the upstream authors whose changes directly caused conflicts or semantic issues — not every contributor.
## Behavioral Change Report — Risk: <N>%
### Safe Changes
- <file> — <what changed, why it's safe>
### Changes Requiring Attention
- <file> — <what changed, potential impact>
### Relevant Upstream Contributors
| Author | Key Changes |
|---|---|
| @<github-handle> | <PR(s) that caused conflicts or semantic issues> |
### Recommended Follow-up
- [ ] <action items, if any>
Safe changes first, so the user confirms routine items quickly and focuses on what matters. If clean (risk ~0%), say so in one line and skip the sections.
On any mid-merge failure:
git merge --abort
Report what happened and let the user decide how to proceed.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer