From merge-main
Fetch and merge the base branch (usually main) into the current feature branch, handling conflicts and pushing. Use when the user says "merge main", "merge in main", "merge base branch", "update from main", "pull in main", "sync with main", "merge main into this branch", "update branch from main", or any variant involving merging the default branch into the current working branch.
How this skill is triggered — by the user, by Claude, or both
Slash command
/merge-main:merge-mainThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Fetch and merge the repository's base branch into the current feature branch.
Fetch and merge the repository's base branch into the current feature branch.
The user may provide these options inline:
<branch>: Override the auto-detected base branch (e.g., --base develop)Run these commands in parallel to understand the current state:
# Check for uncommitted changes
git status
# Detect the repository's default branch
gh repo view --json defaultBranchRef -q '.defaultBranchRef.name'
# Confirm which branch we are on
git branch --show-current
If --base <branch> was specified, use that value instead of the detected default branch.
If gh is not available, fall back to detecting the default branch with:
git remote show origin | grep 'HEAD branch' | sed 's/.*: //'
If the current branch is the default branch itself, warn the user that merging the base branch into itself is a no-op and stop.
If git status shows uncommitted changes (staged or unstaged):
git stash before proceeding, then git stash pop after the merge completes./commit skill, then continue with the merge.git fetch origin <base-branch>
git merge origin/<base-branch>
Where <base-branch> is the detected or overridden base branch name.
If the merge completes without conflicts:
git log HEAD@{1}..HEAD --oneline
If git reports "Already up to date.", report that the branch is already current with the base branch and stop.
If the merge produces conflicts, proceed to the conflict resolution workflow below.
When merge conflicts occur:
git diff --name-only --diff-filter=U
Resolve each conflicted file:
<<<<<<<, =======, >>>>>>>).Stage resolved files:
git add <resolved-file>
git commit -S --no-edit
This uses the default merge commit message generated by git. If the user wants a custom message, they can specify it.
After a successful merge (with or without conflict resolution):
Lockfile changes: If any lockfiles changed during the merge (e.g., package-lock.json, yarn.lock, pnpm-lock.yaml, go.sum, Gemfile.lock, poetry.lock, Cargo.lock, composer.lock), suggest running the appropriate install command:
package-lock.json -> npm installyarn.lock -> yarn installpnpm-lock.yaml -> pnpm installgo.sum -> go mod tidyGemfile.lock -> bundle installpoetry.lock -> poetry installCargo.lock -> cargo buildcomposer.lock -> composer installPush:
git push
If the branch has no upstream, use:
git push -u origin HEAD
If changes were stashed in step 2, pop the stash after the merge completes:
git stash pop
If the stash pop produces conflicts, warn the user and list the conflicted files.
git merge --abort.Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub cboone/agent-harness-plugins --plugin merge-main