git-ops
Git 版本控制操作 (Use when: 需要 clone/commit/push/diff/log 等 git 操作). NOT for: 非版本控制文件操作.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Git 版本控制操作 (Use when: 需要 clone/commit/push/diff/log 等 git 操作). NOT for: 非版本控制文件操作.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
浏览器自动化操作 (Use when: 需要交互式浏览网页、填写表单、点击按钮、翻页抓取动态内容). NOT for: 静态网页抓取(用 web_fetch)、文件下载(用 multimedia_download).
自主编程与代码开发 (Use when: 需要编写/修改/调试代码、创建项目、重构). NOT for: 数据分析、文件格式转换.
数据分析与可视化 (Use when: 需要处理 CSV/Excel 数据、生成图表、统计分析). NOT for: 非数据文件、GUI 操作.
开发辅助工具集 (Use when: 需要代码格式化/依赖管理/环境检测/进程管理/端口扫描). NOT for: 文件读写(用 FileSystem).
通过中国移动 139 邮箱发送邮件(支持附件、纯文本)。凭据已预配置,直接调用即可。
GitHub 仓库操作与协作 (Use when: 需要 PR/Issue/Release 操作、CI 查询、仓库管理). NOT for: 本地 git 操作(用 git-ops).
| name | git-ops |
| description | Git 版本控制操作 (Use when: 需要 clone/commit/push/diff/log 等 git 操作). NOT for: 非版本控制文件操作. |
| metadata | {"rooster":{"emoji":"🌿","platform":["windows","any"],"category":"development","kits":["Interpreter","FileSystem"],"requires":{"python_packages":[],"bins":["git"],"env_vars":[]}}} |
通过 python_interpreter 工具执行 git 命令,完成版本控制相关操作。
git clone https://github.com/user/repo.git ./target_dirgit statusgit add . && git commit -m "message"git push origin maingit log --oneline -20git diff HEAD~1git checkout -b feature/new-featuregit merge feature/new-featureimport subprocess
result = subprocess.run(
["git", "status"],
cwd="/path/to/repo", # 必须指定工作目录
capture_output=True,
text=True,
encoding="utf-8"
)
print(result.stdout)
if result.returncode != 0:
print("ERROR:", result.stderr)
cwd:不指定工作目录会在错误路径执行git config user.name/emailr"C:\path" 或正斜杠 "C:/path"import subprocess, os
repo_path = r"C:\Users\user\Desktop\my-project"
commands = [
["git", "add", "."],
["git", "commit", "-m", "Auto commit by Rooster"],
["git", "push", "origin", "main"],
]
for cmd in commands:
r = subprocess.run(cmd, cwd=repo_path, capture_output=True, text=True, encoding="utf-8")
print(f"$ {' '.join(cmd)}")
print(r.stdout or r.stderr)
if r.returncode != 0:
print("⚠️ Command failed, stopping.")
break