plugins/ls-git/skills/git-merge-into-main/SKILL.md
Use when a finished, reviewed branch is committed and needs to be merged into the default branch in a repo that integrates directly to `main` (not via pull request).
npx skillsauth add LandonSchropp/agent-toolkit plugins/ls-git/skills/git-merge-into-mainInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Merges a finished branch into the default branch (e.g. main) by rebasing it on top, then fast-forwarding. For personal repos that integrate directly to main rather than through pull requests.
This skill does no reviewing and creates no commits. It does not manage worktrees.
Check preconditions: The branch must be committed with no unstaged files. It must also be reviewed by the user (not the same as a pull request review). Stop if either is missing.
Rebase onto the default branch: Find the default branch with git default-branch, then rebase the branch onto it. Always rebase, even for a trivial branch. Resolve any conflicts before continuing — do not --skip or force past them.
Fast-forward and push: Advance the default branch to the rebased branch with a fast-forward only (no merge commit), then push. If the default branch is checked out in another worktree, run the update from that worktree's directory — Git refuses to move a branch that is checked out elsewhere.
default_branch=$(git default-branch)
git rebase "$default_branch"
git -C <default-branch-worktree> merge --ff-only <branch>
git -C <default-branch-worktree> push origin "$default_branch"
| Thought | Reality |
| -------------------------------------------------- | -------------------------------------------------------------------------- |
| "The branch is simple, I'll skip the rebase" | Always rebase onto the default branch first, so the fast-forward is clean. |
| "The rebase conflicted, I'll --skip or force" | Resolve the conflict properly. Never discard commits to get past it. |
| "I'll just merge it, a merge commit is fine" | Fast-forward only. This skill keeps history linear. |
| "main won't move, I'll update it from here" | If it's checked out in another worktree, update it from that worktree. |
| "There are uncommitted changes, I'll merge anyway" | The branch must be committed and reviewed first. Stop. |
tools
Use when working with a stack of GitHub pull requests — creating branches, keeping the stack in sync, or merging in order. Covers Git Town setup, PR targeting, rebasing, and landing the stack.
tools
Use when writing or modifying tests in a Bun project
tools
Use when publishing or releasing a new version of an npm/pnpm/yarn/bun package to the registry. Covers package-manager detection, semver bump selection, tagging, pushing, scoped-package access, authentication, and one-time passwords (OTP).
tools
Use when a finished worktree's branch has been reviewed and committed and needs to land. Rebases onto the latest default branch, then either fast-forwards it into the default branch (personal direct-to-main repos) or pushes it for a pull request (shared feature-branch repos).