git-integrate-branchlisted
Install: claude install-skill JasonWarrenUK/goblin-mode
# 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, resolve preserving **our branch's intent**, then `git commit` (merge) or `git rebase --continue` after each (rebase/squash). Never resolve by discarding our changes wholesale.
4. Run the project's tests to verify the integration.
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 t