git-merge-into-mainlisted
Install: claude install-skill LandonSchropp/agent-toolkit
# Merge Into Main
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.
## Process
1. **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.
2. **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.
3. **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.
4. **Delete the merged branch:** Once the default branch has the commits, delete the branch with `git branch -d <branch>` (the `-d` refuses if it isn't fully merged, so it's a safety check). Run it from the default-branch worktree. If the branch is still checked out in its own worktree, detach that worktree first with `git -C <branch-worktree> checkout --detach` — Git won't delete a branch that is checked out anywhere. If the branch was pushed, also del