Use this skill whenever the user signals they want to merge a branch into the current one — phrases like "merge main", "merge into current branch", "bring in changes from X", "merge branch X", "sync with main". The job is to identify the source branch, show what would change (including a dry-run conflict check), and wait for approval before running any merge command.
How this skill is triggered — by the user, by Claude, or both
Slash command
/vinhnguyen1211-skills:merge-branchThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
The user wants to merge another branch into the current one. Don't run `git merge` yet. Ask which branch, show what's coming in (including a dry-run conflict
The user wants to merge another branch into the current one. Don't run git merge yet. Ask which branch, show what's coming in (including a dry-run conflict
check), flag anything risky, then wait.
Before doing anything else, ask:
Which branch would you like to merge into the current branch?
main— or type a different branch name.
main is the default suggestion. If the user already named a branch in their message (e.g. "merge feature/auth"), skip this step and use that branch.
Once you have the source branch, proceed.
No git merge. No git rebase. Reading is fine — git status, git log, git diff, git branch, git merge-tree are how you gather what to show.
If you feel the urge to run git merge "just to see what happens," that's the signal to stop and show the preview instead.
Useful read-only commands:
git status — confirm the working tree is clean before proposing anythinggit fetch origin {branch} — make sure your view of the source branch is currentgit log HEAD..{branch} --oneline — commits that would come ingit diff HEAD...{branch} --stat — files that would changegit merge-base HEAD {branch} — find the common ancestorBefore showing the preview, simulate the merge to surface conflicts without touching the working tree or any refs:
# Modern Git (2.38+) — uses the real merge strategy, most accurate
git merge-tree --write-tree HEAD {branch}
# Older Git — trivial merge mode, good for ~95% of cases
git merge-tree $(git merge-base HEAD {branch}) HEAD {branch}
Then inspect the output:
# All files touched on both branches
git merge-tree ... | grep 'changed in both'
# Actual conflict markers — the surrounding hunk shows what disagrees
git merge-tree ... | grep -n '<<<<<<< \|>>>>>>> \|======='
For each conflict hunk:
Why this matters:
MERGE_HEAD, no git merge --abort needed.Caveats:
--write-tree, the trivial mode can disagree slightly with a real merge on complex renames or recursive strategies. Mention this if the merge looks
unusual.A short message covering:
git status.git merge (creates a merge commit) is the default. If the history looks like it calls for --ff-only or
--squash, say so and why. Don't just run the alternative — propose it.After showing the proposal, end every approval request with this exact line so the user always sees the required phrase:
Reply
merge approvedto proceed.
Don't run anything until the user replies with the exact phrase merge approved.
Nothing else counts as approval. Not "yes," not "go ahead," not "do it," not "lgtm," not a thumbs up. If the user replies with anything other than merge approved, treat it as feedback — apply any requested changes, re-show the updated state, and ask again (with the same merge approved prompt).
Approval covers the exact source branch, target branch, merge approach, and any conflict resolutions you proposed — nothing else. Things that invalidate approval:
git status since you last showed it.When in doubt, re-show. A second review costs the user one line of "yes"; a bad merge costs them a revert.
Once merge approved is received:
git status first. If the working tree is dirty, stop — tell the user to stash or commit their changes before merging, and do not proceed.git merge {branch} (or the agreed-upon variant).git merge --continue (use
GIT_EDITOR=true git merge --continue to accept the default message non-interactively).Inline in chat. No file needed.
npx claudepluginhub vinhnguyen1211/skills --plugin vinhnguyen1211-skillsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.