git-merge-into-main
/git-merge-into-main
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).
- Author
- LandonSchropp ↗
- Repository
- agent-toolkit ↗
- Licence
- MIT
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
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).
Original author description
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).
How it works
- Process
- Rationalizations
SKILL.md preview
--- name: git-merge-into-main description: 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). --- # 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. ## 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, never from inside the branch's own worktree. Git won't delete a branch that is checked out anywhere, so free it first. If the branch has a worktree that is no longer needed, remove it with `git worktree remove <branch-worktree>`. If something else owns that worktree's lifecycle — the `ls-agent:close-workspace` skill removes herdr worktrees itself — leave it in place and detach it instead with `git -C <branch-worktree> checkout --detach`. If the branch was pushed, also delete the remote with `git push origin --delete <branch>`. ```bash 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" git -C <default-branch-worktree> worktree remove <branch-worktree> # or checkout --detach, if the worktree stays git -C <default-branch-worktree> branch -d <branch> ``` ## Rationalizations | 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. | | "I'll remove the worktree while I'm in it" | Run the removal from the default-branch worktree, or you delete your cwd. | | "Every merged branch's worktree should go" | Leave the ones another skill owns. Detach those instead of removing them. | | "I'll leave the merged branch lying around" | Delete it after the push; `-d` keeps it safe by refusing unmerged branches. |
Versions
The database has no other skills named git-merge-into-main.
Database snapshot: 13.11.2026 · package version af64db7d5e55 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100open-pr
Get a finished branch merged - open a pull request into the default branch (or into a teammate's branch), and after a teammate reviews it, merge it and clean up. Use when someone says "open a PR", "get this into main", "merge my branch", or "it's ready". - 90merge-to-main
Take the current branch's pull request all the way to merged, with local and remote both back on main and in sync. Confirms the merge happened before any cleanup. Use when the user says "merge", or types /merge-to-main. - 100merged
Use when the user says a pull request was merged, to clean up its session, branch and local main - 90commit-push-main
Use when a human explicitly asks to commit and push directly to the default branch, with no feature branch and no pull request. Not for another checked-out branch: use commit-push-current. - 95dev_gate_merge-to-main
Enforce the feature branch workflow — intercept any attempt to merge, push, or commit directly to main and redirect to the correct feature branch process. Triggers on "merge to main", "push to main", "PR to main", or any operation targeting the main branch. - 100update-from-upstream-main
Update the current Remotion branch with the latest canonical main branch. Use when asked to update or sync from upstream main, merge the latest main into a feature branch, fast-forward local main, or bring a pull request branch up to date without rewriting published history.