← ClaudeAtlas

merge-baselisted

This skill should be used when the user asks to "merge the base branch", "update this feature branch from base", or resolve conflicts while merging base into a feature branch.
lklimek/claudius · ★ 1 · Code & Development · score 74
Install: claude install-skill lklimek/claudius
# Merge Base Branch Merge the remote base branch into the current feature branch: pre-merge analysis, conflict resolution, behavioral change report. **Output**: summaries only — never dump raw diffs, file contents, or initial state unless asked. ## Phase 1: Sync with Remote Fetch all remotes and merge the tracked branch (never rebase, never `git pull`: its `--upload-pack` runs arbitrary code); resolve any conflicts per Phase 4 before continuing. ```bash 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 merge --no-edit "$TRACKING" fi ``` ## Phase 2: Identify the Base Branch From PR metadata, using the `git-and-github` skill: ```bash BASE_BRANCH=$(gh pr view --json baseRefName -q .baseRefName 2>/dev/null) ``` If no PR exists, fall back to the repo default branch: ```bash 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. ## Phase 3: Pre-Merge Analysis Read diffs and logs internally to build context (no diff/source output). ```bash 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 --