ship-it
FeaturedCode commit, PR creation, merge, and issue closure workflow via GitHub CLI (gh). Triggers after a goal (GitHub Issue) implementation is complete — commit code, push branch, create PR, merge, then close the issue. Use when the user says "提交代码", "commit and merge", "创建PR", "合入", "关闭issue", "ship-it", or when a goal implementation is done and code needs to be shipped.
Code & Development 235 stars
32 forks Updated 5 days ago MIT
Install
Quality Score: 92/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# After-Goal: 代码提交、PR 合入、Issue 关闭工作流(GitHub)
完成 GitHub Issue 实现后的标准收尾流程:提交代码 → 推送分支 → 创建 PR → 合入 → 关闭 Issue。
## 前置条件
- 当前 git 仓库有已实现的代码变更
- 已知 Issue 编号(如 `#42`)
- gh CLI 已登录(`gh auth status` 可验证)
## 工作流
### Step 1: 提交代码
```bash
# 1a. 检查变更状态
git status
git diff --stat HEAD
# 1b. 暂存本次 Issue 相关的文件(不要 add 不相关的文件)
git add <files related to this issue>
# 1c. 提交,commit message 关联 Issue
git commit -m "$(cat <<'EOF'
{简要描述} (#issue-number)
{可选的详细说明}
EOF
)"
```
**关键规则:**
- commit message 中包含 `#issue-number` 以关联 Issue
- 只暂存当前 Issue 相关的文件,不要混入其他变更
### Step 2: 推送分支
```bash
# 如果还在 main/master 上,先创建功能分支
git checkout -b {branch-name} # 如已在功能分支则跳过
# 推送到远程
git push -u origin {branch-name}
```
分支命名建议:`feat/issue-42-short-desc` 或 `fix/issue-42-short-desc`
### Step 3: 创建 PR
```bash
gh pr create \
--title "{简要描述}" \
--body "$(cat <<'EOF'
## Summary
- 实现内容概述
Closes #{issue-number}
## Test plan
- [ ] 测试项 1
- [ ] 测试项 2
EOF
)"
```
**关键规则:**
- PR body 中写 `Closes #N` 或 `Fixes #N`,合入后 GitHub 自动关闭 Issue
- title 简洁,不超过 70 字符
### Step 4: 合入 PR
```bash
# 4a. 查看 PR 状态(确认 checks 通过)
gh pr checks
# 4b. 合入(默认 merge commit,可选 --squash 或 --rebase)
gh pr merge --squash --delete-branch
```
**参数说明:**
- `--squash`: 压缩为单个 commit 合入(推荐)
- `--rebase`: rebase 合入
- `--merge`: 普通 merge commit
- `--delete-branch`: 合入后删除远程分支
### Step 5: 添加实现总结评论
PR 合入后,始终在 Issue 上添加实现总结评论,方便后续直接从 Issue 回溯代码变更。
```bash
gh issue comment {issue-number} --body "$(cat <<'EOF'
## 实现总结
- **核心变更**:{从 PR body 提取的实现摘要}
- *...
Details
- Author
- smallnest
- Repository
- smallnest/goal-workflow
- Created
- 3 months ago
- Last Updated
- 5 days ago
- Language
- HTML
- License
- MIT
Similar Skills
Semantically similar based on skill content — not just same category
Code & Development Listed
gh-merge
将当前分支合并到 GitHub 目标分支(通常是 main)。 自动处理代码提交、创建 PR、监控 CI Checks、处理错误直到合并成功。
0 Updated 3 weeks ago
l8ai-cn AI & Automation Listed
gh-pr-workflow
当用户要求"提 PR/创建 PR/请求评审/合并 PR/关闭 PR"时触发。 用 gh CLI 完成 GitHub PR 全流程:创建 → 评审 → 修复 → 合并 → 清理。 MUST 用 gh 命令行(不用 Web 界面),保持留痕。
1 Updated 1 weeks ago
structure-projects AI & Automation Featured
git-workflow
安全处理 Git 状态检查、提交信息、commit、分支、push、PR 和 rebase。用于用户要求检查改动、生成或创建提交、管理分支、推送、发起 PR 或整理历史时;严格区分每个动作的授权,并保护工作树中已有和无关的修改。
783 Updated 2 days ago
laolaoshiren