返回顶部
g

git-cli Git命令行工具

Helper for using the Git CLI to inspect, stage, commit, branch, and synchronize code changes. Use when the user wants to understand or perform Git operations from the command line, including safe status checks, diffs, branching, stashing, and syncing with remotes.

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

git-cli

Git CLI 技能 — 工作方式

当用户询问有关命令行 Git 的问题时使用此技能:变更内容、暂存/提交、分支、推送/拉取、贮藏、历史记录、标签、合并/变基或克隆。

你的工作流程

  1. 1. 确认上下文:确保 Git 已加入 PATH 环境变量,且用户位于(或将在)仓库中执行命令。如果不确定,建议运行 git status 或从技能目录执行 scripts/is-repo.sh。
  2. 安全第一:优先使用只读命令(git status、git diff、git log)。除非用户明确要求并理解风险,否则不要建议破坏性命令(git reset --hard、git clean -fdx、git push --force)。对于恢复操作,在建议重置/检出前先使用 git reflog 查找提交。
  3. 提供适当详细程度
- 快速回答:使用下方的快速参考表,回复确切的命令。 - 分步说明或边界情况:指向或引用 reference/ 中的内容(例如 reference/workflows.mdreference/troubleshooting.md)。 - 自动化/可重复检查:使用或调整 scripts/ 中的脚本,并告知用户如何运行。 - 模板(提交信息、.gitignore):使用或复制 assets/ 中的内容。

快速参考(优先使用此表)

任务命令
状态与差异git status · git diff · git diff --staged · git diff --stat
暂存/取消暂存
git add <路径> 或 git add . · git restore --staged <路径> | | 提交 | git commit -m 信息 | | 分支 | git branch · git branch -a · git switch -c 新分支 · git switch 现有分支 | | 同步远程 | git fetch · git pull · git push -u origin <分支> 然后 git push | | 贮藏 | git stash · git stash list · git stash apply / git stash pop | | 历史记录 | git log --oneline --decorate --graph -n 20 · git blame <文件> | | 克隆/初始化 | git clone · git init · git remote add origin | | 远程仓库 | git remote -v · git remote show origin · git branch -vv | | 丢弃(破坏性) | git restore <文件>(工作树) · git restore --staged <文件>(取消暂存) | | 修改提交 | git commit --amend --no-edit 或 -m 信息 | | 标签 | git tag · git tag v1.0 · git push origin v1.0 或 --tags | | 合并/变基 | git merge <分支> · git rebase <分支> · 冲突 → 解决 → git add → git commit 或 git rebase --continue |

查找位置

需求位置
完整命令列表、选项、示例reference/commands.md
分步工作流程(分支、发布、冲突)
reference/workflows.md | | 错误、恢复、分离头指针、.gitignore | reference/troubleshooting.md | | 运行检查(是否为仓库、状态摘要、分支信息) | scripts/ — 从仓库根目录运行 | | 提交信息或 .gitignore 模板 | assets/ |

脚本(从仓库根目录运行)

  • - scripts/is-repo.sh — 如果当前目录是 Git 仓库则退出码为 0,否则为 1。用于在建议命令前确认上下文。
  • scripts/status-summary.sh — 简短状态 + 分支 + 最近提交。当用户询问我当前的状态是什么?时使用。
  • scripts/branch-list.sh — 本地和远程分支及上游信息。当用户询问分支或推送目标时使用。

在 Windows 上:在 Git Bash 或 WSL 中运行(例如 bash scripts/status-summary.sh)。

资源文件

  • - assets/commit-msg-template.txt — 传统或结构化提交信息的模板;当用户询问提交信息格式时建议使用。
  • assets/gitignore-common.txt — 常见的 .gitignore 模式;当用户有大量未跟踪文件或询问 .gitignore 示例时建议使用。

当用户需要图表(例如分支/合并流程)时,用文字描述或指向参考文档;仅当用户明确要求可视化内容时才在 assets/ 中创建或引用图片。

标签

skill ai

通过对话安装

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

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 git-cli-1776119711 技能

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

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

通过命令行安装

skillhub install git-cli-1776119711

下载

⬇ 下载 git-cli v1.0.1(免费)

文件大小: 11.77 KB | 发布时间: 2026-4-15 12:53

v1.0.1 最新 2026-4-15 12:53
- Major update: Added reference, assets, and scripts directories to provide quick references, check scripts, and templates.
- Added quick reference table for common Git tasks and commands.
- Introduced scripts for checking Git repo state, status summary, and branch listing.
- Included assets with commit message and .gitignore templates for easy reuse.
- Added detailed reference and troubleshooting guides in the reference directory.
- Emphasized safety and context confirmation, with improved workflow and pointers to reusable content.

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

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

p2p_official_large
返回顶部