← 返回
开发者工具 中文

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...
帮助使用 Git CLI 检查、暂存、提交、分支及同步代码变更。在用户想了解或执行 Git 操作时使用。
openlang-cn openlang-cn 来源
开发者工具 clawhub v1.0.1 2 版本 99952.9 Key: 无需
★ 1
Stars
📥 2,103
下载
💾 34
安装
2
版本
#latest

概述

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

  1. Confirm context: Ensure Git is on PATH and the user is in (or will run commands in) a repo. If unsure, suggest git status or run scripts/is-repo.sh from the skill directory.
  2. 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, use git reflog to find a commit before suggesting reset/checkout.
  3. 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 or git add . · git restore --staged |

| 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 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 |

| Clone / init | git clone · git init · git remote add origin |

| Remotes | git remote -v · git remote show origin · git branch -vv |

| Discard (destructive) | git restore (working tree) · git restore --staged (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 · git rebase · conflict → fix → git addgit 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.

版本历史

共 2 个版本

  • v1.0.1 当前
    2026-03-29 01:12 安全 安全
  • v1.0.0
    2026-03-14 02:10

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Clawhub Cli

openlang-cn
使用 ClawHub CLI 从 clawhub.ai 搜索、安装、更新和发布智能体技能。用于即时获取新技能、同步已安装技能等。
★ 5 📥 2,175
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 677 📥 325,745
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 181,424