git-merge-to-main
Git Merge to Main
Overview
Merge the current branch into main, then delete the source branch locally because it's now fully merged. Safe by design — never --force, never -D (only -d), never auto-resolves conflicts, never auto-pushes.
Announce at start: "I'm using the git-merge-to-main skill to merge <source-branch> into main and delete it."
Preconditions
Run these checks before touching anything. Fail closed on any violation — report and stop.
| # | Check | Command | On fail |
|---|---|---|---|
| 1 | In a git repo | git rev-parse --is-inside-work-tree |
Abort: "Not a git repository." |
| 2 | HEAD attached (not detached) | git symbolic-ref -q HEAD |
Abort: "Detached HEAD; checkout a branch first." |
| 3 | Current branch is not main |
[ "$(git branch --show-current)" != "main" ] |
Abort: "Already on main; nothing to merge." |
| 4 | Working tree clean | [ -z "$(git status --porcelain)" ] |
Abort: "Working tree has uncommitted changes; commit/stash first." |
| 5 | main branch exists locally |
git rev-parse --verify main |
Abort: "main branch not found locally; create it or use git-merge-to-dev." |
More from chann/skills
code-review
Use when the user asks to review code, review changes, review a commit, review a PR, audit code quality, check for security issues, or generate a code review report. Trigger on phrases like "review my changes", "코드 리뷰", "check my code", "review the last commit", "what do you think of this diff", "compare branches", "code audit" — even if they don't say "code review" explicitly. For persistent file output use `code-review-md` (markdown) or `code-review-html` (markdown + HTML).
10code-review-md
Use when the user asks to save a code review to a file, write a markdown review report, persist review findings, or generate a review file in `.reviews/`. Trigger on phrases like "review my changes and save", "write the code review", "리뷰 결과 파일로 저장", "마크다운 리뷰 보고서", "/code-review-md". For interactive (no-file) review use the `code-review` skill; for HTML output use `code-review-html`.
8code-review-html
Use when the user asks for a styled HTML code review report, a browser-readable review, or both markdown + HTML output. Trigger on phrases like "/code-review-html", "HTML 리뷰 보고서", "styled review report", "review with badges/sidebar". For markdown-only output use `code-review-md`; for in-conversation review use `code-review`.
8long-task
Use when the user asks to build a project end-to-end, run autonomous multi-hour or multi-day development, or orchestrate multi-milestone work without human intervention. Trigger phrases include "build this whole project", "implement this end-to-end", "do this autonomously", "run a long task", "long-running agent", "build it from scratch and don't ask", or the explicit `/long-task` command. Also use for lifecycle subcommands such as `/long-task status`, `/long-task pause`, `/long-task resume`, `/long-task clear`, and `/long-task complete`.
5git-commit
Use when the user asks to commit changes, organize commits, write commit messages, or split working-tree changes into Conventional Commits. Trigger on phrases like "commit my changes", "커밋해줘", "커밋 분리", "make commits", "/git-commit", or whenever the user wants to turn current changes into Conventional Commit-style commits. For commit + push use `git-commit-push`; for rewriting non-Conventional commit history use `git-commit-rewrite`.
5git-commit-push
Use when the user asks to commit working-tree changes AND push to the remote. Trigger on phrases like "commit and push", "커밋하고 푸시해줘", "/git-commit-push", "push my commits". Runs the git-commit workflow, then `git push` (never `--force`). For commit-only use `git-commit`; for history rewrite use `git-commit-rewrite`.
5