返回顶部
g

git-managerGit管理工具

Execute common Git operations: status, commit, push, pull, branch management, PR creation. Use when user mentions Git, repository, commit, push, pull, branch, merge, or code versioning. Provides safe, auditable operations with dry-run support.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
144
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

git-manager

Git Manager 技能

该技能安全地执行常见的Git命令。它在git命令行工具的基础上增加了额外的安全检查并输出结构化结果。

功能

  • - status - 显示工作树状态
  • commit - 暂存更改并提交(附带提交信息)
  • push - 推送到远程仓库
  • pull - 从远程仓库拉取(变基或合并)
  • branch - 创建、列出、删除分支
  • checkout - 切换分支
  • merge - 合并分支
  • stash - 暂存/应用更改
  • log - 显示提交历史
  • diff - 显示更改内容

安全特性

  • - 默认禁止强制推送(必须显式使用--force参数)
  • 受保护分支:无法直接删除或提交到main/master/production分支
  • 预演模式:在执行前预览操作结果
  • 自动提交信息质量检查(LLM可优化提交信息)
  • 所有操作均记录日志至~/.openclaw/logs/git-manager.log

使用场景

用户说:

  • - 查看Git状态
  • 提交代码
  • 推送到远程仓库
  • 拉取最新代码
  • 创建新分支
  • 合并分支
  • 查看提交历史

调用方式

bash

查看状态


git-manager --action status --repo /path/to/repo

提交所有更改

git-manager --action commit --repo /path/to/repo --message feat: add user auth

提交指定文件

git-manager --action commit --repo /path/to/repo --files [file1,file2] --message fix: bug in payment

推送

git-manager --action push --repo /path/to/repo --branch feature-xyz

拉取

git-manager --action pull --repo /path/to/repo --branch main

创建分支

git-manager --action branch --repo /path/to/repo --create new-branch --from main

切换分支

git-manager --action checkout --repo /path/to/repo --branch feature-xyz

查看差异

git-manager --action diff --repo /path/to/repo --files [file1]

输出格式

JSON格式,包含以下字段:

  • - success: 布尔值
  • output: 字符串(原始git输出)
  • error: 字符串(如果失败)
  • changedfiles: 数组(提交时)
  • commitsha: 字符串(提交后)
  • branch: 当前分支

示例:
json
{
success: true,
action: commit,
commit_sha: abc123def,
changedfiles: [src/auth.py, tests/testauth.py],
output: [main abc123] feat: add user auth\n 2 files changed, 45 insertions(+)
}

环境变量配置

  • - GITMANAGERLOG: 活动日志路径(默认~/.openclaw/logs/git-manager.log)
  • GITMANAGERDRYRUN: 设置为1默认启用预演模式
  • GITMANAGERPROTECTEDBRANCHES: 逗号分隔列表(默认main,master,production)

与OpenClaw的集成

在开发者角色会话中使用时:

  • - 如果未提供--repo参数,自动将会话的cwd作为仓库路径
  • 可链式操作:status -> commit -> push一气呵成
  • 根据git diff建议提交信息(如果省略--message参数)

OpenClaw会话示例

python

开发者会话


sessions_spawn(
task=提交刚才修改的登录页面样式,
config=configs/developer.yaml,
attachments=[]
)

该技能将执行:git add . && git commit -m style: improve login page && git push

局限性

  • - 无法自动处理合并冲突(需要人工介入)
  • 不支持交互式变基(复杂历史编辑)
  • 假设使用标准Git工作流(无自定义钩子)
  • 推送/拉取需要预先配置SSH密钥

故障排除

问题检查项
权限被拒绝(公钥)SSH代理是否运行?ssh-add -l
不是Git仓库
--repo路径是否正确? | | 分支受保护 | 无法提交到main分支;先创建功能分支 | | 合并冲突 | 手动解决;技能仅检测冲突 |

未来增强

  • - 通过GitHub CLI创建PR(gh pr create)
  • 基于提交信息自动版本升级(语义化发布)
  • 分支清理(删除已合并的分支)

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 git-manager-1776000608 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 git-manager-1776000608 技能

通过命令行安装

skillhub install git-manager-1776000608

下载

⬇ 下载 git-manager v1.0.0(免费)

文件大小: 3.98 KB | 发布时间: 2026-4-13 10:26

v1.0.0 最新 2026-4-13 10:26
Initial release of git-manager skill.

- Safely execute common Git operations: status, commit, push, pull, branch, checkout, merge, stash, log, diff.
- Safety features: prevents force push by default, protects main/master/production branches, supports dry-run, logs all actions.
- Structured JSON output for all actions, useful for automation and integration.
- Commit message quality checks and suggestions included.
- Configurable via environment variables.
- Easily integrates with OpenClaw developer sessions, supports chained operations and auto-suggested commit messages.
- Limitations: no automatic merge conflict resolution or interactive rebase; SSH setup required for push/pull.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部