git-cli
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.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-10
- Stars
- ★ 41
- Forks
- 9
01 前言 Front Matter
- name
- git-cli
- description
- 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.
02 资源文件 27
- 参考文档_meta.json126 B
- 参考文档agent_eval/README.md709 B
- 参考文档agent_eval/task_git_usability.md8.3 KB
- 资产文件assets/commit-msg-template.txt528 B
- 资产文件assets/gitignore-common.txt534 B
- 资产文件assets/README.md463 B
- 参考文档mock_assets/assets/commit-msg-template.txt528 B
- 参考文档mock_assets/assets/gitignore-common.txt534 B
- 参考文档mock_assets/assets/README.md463 B
- 其他mock_assets/bin/git-remote-admin9.1 KB
- 参考文档mock_assets/reference/commands.md4.8 KB
- 参考文档mock_assets/reference/README.md603 B
- 参考文档mock_assets/reference/troubleshooting.md3.0 KB
- 参考文档mock_assets/reference/workflows.md2.9 KB
- 脚本mock_assets/runtime/git-remote-httpd.py19.2 KB
- 脚本mock_assets/skill_hooks/00_prepare_git_remote.sh2.6 KB
- 参考文档MOCK_SKILL_USAGE.md8.3 KB
- 参考文档README.md3.2 KB
- 参考文档reference/commands.md4.8 KB
- 参考文档reference/README.md603 B
- 参考文档reference/troubleshooting.md3.0 KB
- 参考文档reference/workflows.md2.9 KB
- 脚本scripts/branch-list.sh387 B
- 脚本scripts/is-repo.sh284 B
- 脚本scripts/README.md419 B
- 脚本scripts/status-summary.sh396 B
- 参考文档skill-card.md2.3 KB
03 SKILL.md 正文
Git CLI Skill — How to Work
Use this skill when the user asks about Git from the command line: what changed, staging/committing, branching, push/pull, stashing, history, tags, merge/rebase, or cloning.
Your Workflow
- Confirm context: Ensure Git is on PATH and the user is in (or will run commands in) a repo. If unsure, suggest
git statusor runscripts/is-repo.shfrom the skill directory. - Safety first: Prefer read-only commands (
git status,git diff,git log). Do not suggest destructive commands (git reset --hard,git clean -fdx,git push --force) unless the user explicitly asks and understands the risk. For recovery, usegit reflogto find a commit before suggesting reset/checkout. - Give the right level of detail:
- Quick answer: Use the Quick Reference table below and reply with the exact command(s).
- Step-by-step or edge cases: Point to or quote from reference/ (e.g. reference/workflows.md, reference/troubleshooting.md).
- Automation / repeatable checks: Use or adapt scripts in scripts/ and tell the user how to run them.
- Templates (commit message, .gitignore): Use or copy from assets/.
Quick Reference (use this first)
| Task | Command |
|---|---|
| State & diff | git status · git diff · git diff --staged · git diff --stat |
| Stage / unstage | git add <path> or git add . · git restore --staged <path> |
| Commit | git commit -m "message" |
| Branch | git branch · git branch -a · git switch -c new · git switch existing |
| Sync remote | git fetch · git pull · git push -u origin <branch> then git push |
| Stash | git stash · git stash list · git stash apply / git stash pop |
| History | git log --oneline --decorate --graph -n 20 · git blame <file> |
| Clone / init | git clone <url> · git init · git remote add origin <url> |
| Remotes | git remote -v · git remote show origin · git branch -vv |
| Discard (destructive) | git restore <file> (working tree) · git restore --staged <file> (unstage) |
| Amend | git commit --amend --no-edit or -m "message" |
| Tags | git tag · git tag v1.0 · git push origin v1.0 or --tags |
| Merge / rebase | git merge <branch> · git rebase <branch> · conflict → fix → git add → git commit or git rebase --continue |
Where to Look
| Need | Location |
|---|---|
| Full command list, options, examples | reference/commands.md |
| Step-by-step workflows (branch, release, conflict) | reference/workflows.md |
| Errors, recovery, detached HEAD, .gitignore | reference/troubleshooting.md |
| Run checks (is repo, status summary, branch info) | scripts/ — run from repo root |
| Commit message or .gitignore template | assets/ |
Scripts (run from repository root)
- scripts/is-repo.sh — Exit 0 if current dir is a Git repo, else 1. Use to confirm context before suggesting commands.
- scripts/status-summary.sh — Short status + branch + last commit. Use when user asks "what’s my current state?"
- scripts/branch-list.sh — Local and remote branches with upstream. Use when user asks about branches or push target.
On Windows: run in Git Bash or WSL (e.g. bash scripts/status-summary.sh).
Assets
- assets/commit-msg-template.txt — Template for conventional or structured commit messages; suggest when user asks for commit message format.
- assets/gitignore-common.txt — Common .gitignore patterns; suggest when user has many untracked files or asks for .gitignore examples.
When the user needs a diagram (e.g. branch/merge flow), describe it in text or point to reference; only create or reference images in assets/ if the user explicitly asks for a visual.
04 同仓库更多 Skills
secureclaw
Security skill for OpenClaw agents (7-framework aligned). 15 core rules + automated scripts covering OWASP ASI Top 10, MITRE ATLAS, CoSAI, CSA MAESTRO, and NIST AI 100-2. Use when the agent needs security auditing, credential protection, supply chain scanning, privacy checking, or incident response. By Adversa AI (https://adversa.ai). v2.2.0.
secureclaw
Security hardening toolkit for OpenClaw. Run audits, apply fixes, scan skills, monitor costs and memory integrity.
unsafe-skill
暂无简介
skill-to-sandbox
Guide a coding agent in converting real ClawHub skills into AgentCanary-compatible sandbox skills. Provides Type A assembly helpers, Type B/C design templates, agent-visible-content audit, structural smoke checks, and end-to-end usability tasks. Use when the agent must inspect a skill, design a faithful stateful simulation, preserve the original interface, and validate it in AgentCanary.
ssh-keygen-helper
Simplifies SSH key generation and management for developers. Automatically configures SSH keys for GitHub, GitLab, and Bitbucket. Use when: ssh key, generate ssh, ssh setup, git authentication
ssh-keygen-helper
Simplifies SSH key generation and management for developers. Automatically configures SSH keys for GitHub, GitLab, and Bitbucket. Use when: ssh key, generate ssh, ssh setup, git authentication