Skip to content
Back to skills

Branch Integrate

ASecurity

Integrate a target branch into the current one by merge, rebase or squash

  • 5 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 5, 2026
ai-agentsbashtestinggit

Security analysis

A100/100

Scanned October 5, 2026

npx -y skills add JasonWarrenUK/goblin-mode --skill branch-integrate --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Branch Integrate?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Branch Integrate
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jasonwarrenuk-branch-integrate/badge)](https://www.skillsdirectory.com/skills/jasonwarrenuk-branch-integrate)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: "Branch: Integrate"
description: "Integrate a target branch into the current one by merge, rebase or squash"
when_to_use: "When main (or another branch) has moved on and needs folding into the current branch: picks merge/rebase/squash and handles conflicts."
model: sonnet
effort: medium
metadata:
  glyph: ᛊ
  family: branch
disable-model-invocation: true
allowed-tools: ["Bash(git:*)", "Bash(~/.claude/library/scripts/git-integrate.sh:*)", "Read", "Glob", "Grep", "Edit"]
arguments: ["strategy", "target"]
argument-hint: "[merge|rebase|squash] [target branch, default main]"
---

# Integrate `$target` into the current branch

Replaces the former git-branch-merge / git-branch-rebase / git-branch-squash trio. The mechanical flow (fetch, integrate, state checks) lives in the script; you handle conflicts, the squash commit message, tests and the push.

`$strategy` is required (`merge`, `rebase` or `squash`); `$target` defaults to `main` when empty.

## Steps

1. Check the current branch name and **confirm with the user** before proceeding.
2. Do NOT create a worktree; work in the current directory.
3. Run `"$HOME"/.claude/library/scripts/git-integrate.sh $strategy $target` (bare `$strategy` when `$target` is empty). Its exit codes:
   - **0**: integration done. For `squash` the branch's changes are staged as one unit: write a single descriptive commit message (conventional commits) and commit.
   - **2**: state error (dirty tree, detached HEAD, wrong branch, fetch failure). Report the script's message and stop; fix only what the user asks you to fix.
   - **3**: conflicts, left in place. List them, then resolve with judgement about whose change is *right*: our branch's intent wins for the work this branch is about; the incoming side (usually main) wins elsewhere, since its conflicting change typically carries a fix this branch predates. Never resolve by discarding our changes wholesale, and never by discarding main's either. Then `git commit` (merge) or `git rebase --continue` after each (rebase/squash).
4. Run the project's tests to verify the integration. A mod under `marketplace/<name>/` whose `hooks/` holds `*.test.ts(x)` is tested with `claude plugin test marketplace/<name>`, never bare `bun test`: the runner supplies `claude-code/testing`, so bare bun fails to load it whatever the code does. Check the mod's README for its test command before running anything.
5. **Only when tests pass**, push: `git push` after a merge; `git push --force-with-lease` after a rebase or squash. Never plain `--force`.

## Red flags

**Never:** push with failing tests; force-push without `--with-lease`; run the script on a dirty tree ("stash it yourself" is the user's call, not yours).
**Always:** confirm the branch first; keep conflict resolutions minimal and intent-preserving.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.