/git-hygiene:merge-strategy [optional repository or pull request]from git-hygiene
Recommends squash-and-merge, rebase-and-merge, or a merge commit for the branch in front of you, based on its actual commits, whether the branch is shared, and whether its history is already public. Use when the user asks which merge method to use, whether to squash or rebase, how to merge a pull request, or invokes /merge-strategy. Read-only: it recommends and explains; it never merges, rebases, pushes, or deletes.
Ships in git-hygiene. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are choosing a merge strategy for one branch or pull request. Inspect the actual branch and state the evidence before recommending anything. This skill does not perform the merge.
If the user named a pull request, use it. Otherwise use the current branch and its upstream when one exists. If there is no current branch, or neither an upstream nor a resolvable local default exists, say what is missing and stop. Do not infer a strategy from the branch name.
For a local branch, gather:
git branch --show-current
git rev-parse --abbrev-ref --symbolic-full-name @{upstream}
git symbolic-ref --short refs/remotes/origin/HEAD
git rev-list --count <default>..<branch>
git log --oneline --decorate <default>..<branch>
git log --merges --oneline <default>..<branch>
git status --short
Resolve <default> before running the comparison: for a pull request, use its
baseRefName (and the matching remote ref); for a local branch, use
origin/HEAD from the command above, falling back to the repository's local
default branch only when that symbolic ref is unavailable. If the target cannot
be resolved, stop without a commit count or merge recommendation.
For a GitHub pull request, gather the repository, base and head branch, draft state, review state, commit count, and whether the head branch is already on the remote:
gh pr view <number-or-url> --json baseRefName,headRefName,headRepositoryOwner,isCrossRepository,isDraft,reviewDecision,commits,url
If any comparison or review fact cannot be read, say so and withhold a precise recommendation. Unknown is not a reason to choose the least disruptive-looking option.
A remote branch proves the history is public to that remote; it does not prove that nobody else has based work on it. Do not treat “the branch is pushed” as “the branch is private.” If the user has not said whether another contributor or branch depends on this history, ask one short question:
Has anyone else based work on this branch, or is it yours alone?
Record the answer as shared or private. If the user cannot tell, treat it as
shared and explain that the conservative choice preserves the existing graph.
Use these rules in order:
If the branch is a draft, has unresolved review changes, has uncommitted local files, or has no successful comparison with the target, say not ready to merge before discussing the three methods. A strategy is not approval to merge.
Return:
Recommendation: {squash-and-merge | rebase-and-merge | merge commit | not ready}
Evidence:
- {commit count and whether the commits are meaningful or fixups}
- {private/shared and public/unshared facts}
- {review/draft/working-tree state}
Why this fits: {one or two sentences}
Why not the other two: {brief tradeoff}
Next step: {the user can choose the merge method in GitHub or run the exact
command themselves; this skill did not merge, rebase, push, or delete anything}
Never claim that one strategy is universally correct. The point is to make the tradeoff visible from the branch in front of the user.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub sarahcallmesmadds/infra-plugins --plugin git-hygiene4 skills in this plugin
/setupSets up Git Hygiene's optional project worktree location guard by choosing the project and worktree folders and writing them to user-owned configuration. Use when the user asks to configure or enable the worktree location guard, or invokes /git-hygiene:setup./stale-branchesLists old branches and separates the ones proved safe to delete from the ones not proved safe, then deletes the proved-safe ones after you approve them. Works on the current checkout, on a named GitHub repository, or across every repository you own. Use when the user asks "what branches can I delete", "clean up my branches", "do I have stale branches", "am I still carrying old branches", "tidy up git", or explicitly invokes /stale-branches. Never deletes anything without an explicit yes, and never routes a held branch into deletion./Other plugins' skills for the same job