GitHub 效率翻倍秘籍 - github 技能实战指南 开发者的痛点 作为开发者,你每天可能要在 GitHub 上: 查看 Issue 和 PR 状态 检查 CI/CD 构建是否通过 查询代码仓库信息 管理项目和协作 传统的打开网页、点点点的操作方式,太慢了! 每次都要: 打开浏览器 输入 github.com 登录(如果 session 过期) 找到对应的仓库 点击进入... 重复这个流程 N 次 一个小时就这样没了 😭 github 技能:命令行界的 GitHub 超人 github 技能基于强大的 CLI,让你在终端里完成几乎所有 GitHub 操作。 不用打开浏览器,不用切换窗口,一条命令搞定。
作为开发者,你每天可能要在 GitHub 上:
传统的打开网页、点点点的操作方式,太慢了!
每次都要:
一个小时就这样没了 😭
github 技能基于强大的 gh CLI,让你在终端里完成几乎所有 GitHub 操作。
不用打开浏览器,不用切换窗口,一条命令搞定。
查看所有 Issue:
gh issue list
查看特定 Issue:
gh issue view 123
创建新 Issue:
gh issue create --title "Bug: 登录失败" --body "复现步骤..."
关闭 Issue:
gh issue close 123
批量操作 Issue:
# 关闭所有 "bug" 标签的 Issue gh issue list --label bug --json number | jq '.[].number' | xargs gh issue close
查看所有 PR:
gh pr list
查看特定 PR:
gh pr view 456
创建 PR:
gh pr create --title "新功能:用户系统" --body "变更说明..."
合并 PR:
gh pr merge 456
代码审查:
# 查看 PR 变更 gh pr diff 456 # 添加评论 gh pr comment 456 --body "这里可以优化一下"
查看工作流运行状态:
gh run list
查看特定运行详情:
gh run view 789
重新运行失败的 CI:
gh run rerun 789
查看实时日志:
gh run view 789 --log
使用 GitHub API 进行复杂查询:
# 查询用户信息 gh api /users/torvalds # 查询仓库 Star 数 gh api /repos/openclaw/openclaw | jq .stargazers_count # 查询最近的 commits gh api /repos/openclaw/openclaw/commits
组合查询:
# 查找所有需要 review 的 PR gh pr list --search "is:open is:pr review-requested:@me"
**场景:**每天早上需要向团队汇报项目进展
**传统方式:**手动打开每个仓库,查看 Issue、PR、CI 状态,耗时 15 分钟
使用 github 技能:
# 创建一个脚本 report.sh #!/bin/bash echo "📊 今日项目报告" echo "" echo "🔥 需要处理的 Issue:" gh issue list --state open --limit 5 echo "" echo "✨ 待审核的 PR:" gh pr list --state open --limit 5 echo "" echo "⚙️ CI 状态:" gh run list --limit 3
运行脚本,30 秒搞定!
**场景:**项目中发现了 10 个类似的 Bug,需要批量修复和关闭
**传统方式:**一个个打开网页,点击关闭,手动添加评论,耗时 20 分钟
使用 github 技能:
# 查找所有 "bug" 标签的 Issue gh issue list --label bug --json number,title | jq -r '.[] | "\(.number): \(.title)"' # 批量关闭并添加评论 for issue in $(gh issue list --label bug --json number | jq -r '.[].number'); do gh issue close $issue --comment "已在 v2.0.1 中修复" done
2 分钟搞定,还能喝杯咖啡 ☕
**场景:**团队中有 5 个 PR 需要你 Review
**传统方式:**打开邮件,点击每个链接,切换标签页,眼花缭乱
使用 github 技能:
# 查看所有需要 review 的 PR gh pr list --search "is:open is:pr review-requested:@me" # 查看 PR 变更 gh pr diff 123 # 添加 review 评论 gh pr review 123 --body "LGTM, minor suggestions" --comment-left
在终端里高效完成代码审查!
| 操作 | 网页操作 | github 技能 |
|---|---|---|
| 查看 Issue | 30 秒 | 2 秒 |
| 创建 PR | 2 分钟 | 20 秒 |
| 查看 CI 日志 | 1 分钟 | 5 秒 |
| 批量操作 | 不可能 | 几秒 |
# 在 ~/.bashrc 或 ~/.zshrc 中添加 alias ghi='gh issue' alias ghpr='gh pr' alias ghrun='gh run' # 更复杂的别名 alias my-prs="gh pr list --search 'is:open is:pr author:@me'" alias todo="gh issue list --search 'is:open is:issue assignee:@me'"
# 结合 fzf 进行交互式选择 gh pr list | fzf | awk '{print $1}' | xargs gh pr view # 结合 jq 进行数据处理 gh issue list --json number,title,state | jq '.[] | select(.state == "open")'
# 自动创建 Release #!/bin/bash VERSION=$1 gh release create $VERSION \ --title "Release $VERSION" \ --notes "See CHANGELOG.md for details"
「以前每天早上查看 GitHub 状态要花 20 分钟,现在写个脚本,10 秒搞定。时间省下来写代码了!」
— 全栈开发者 @阿杰
「作为开源维护者,要处理几十个 Issue 和 PR。github 技能让我能快速响应,贡献效率提升了 3 倍。」
— 开源项目维护者 @开源大叔
"The
ghCLI is a game changer. Combined with OpenClaw's github skill, it's super powerful!"
— GitHub 用户 @devmaster
skillhub install github
gh auth login
# 查看你的 Issue gh issue list # 查看你的 PR gh pr list
gh --help别让繁琐的 GitHub 操作拖慢你的开发节奏。
🔥 立即安装 github 技能,让你的 Git 体验起飞!