ClawSkills logoClawSkills

Git Summary

获取当前 Git 仓库的快速摘要,包括状态、最近的提交、分支和贡献者。

介绍

# Git Summary Skill

此技能提供了当前 Git 仓库状态的全面概览。

## 用法

当用户请求 git 摘要、仓库概览,或希望了解 git 项目的当前状态时,请使用终端运行以下命令,并以清晰、有条理的格式呈现结果。

## 指令

1. **仓库状态**:运行 `git status --short --branch` 以获取当前分支和工作目录的状态。

2. **最近的提交**:运行 `git log --oneline -10 --decorate` 以显示最近 10 次提交及其分支/标记装饰。

3. **分支概览**:运行 `git branch -a --list` 以列出所有本地和远程分支。

4. **远程信息**:运行 `git remote -v` 以显示已配置的远程仓库。

5. **未提交更改摘要**: - 运行 `git diff --stat` 查看未暂存的更改 - 运行 `git diff --cached --stat` 查看已暂存的更改

6. **贡献者**(可选,用于提供更多上下文):运行 `git shortlog -sn --all | head -10` 以显示前 10 位贡献者。

## 输出格式

以结构化格式呈现收集到的信息:

``` ## 📊 Git Repository Summary ### Current Branch & Status - Branch: `<branch_name>` - Status: <clean/dirty with X modified, Y staged, Z untracked> ### Recent Commits (Last 10) <formatted commit list> ### Branches - Local: <count> branches - Remote: <count> branches <list notable branches> ### Remotes <list remotes with URLs> ### Uncommitted Changes <summary of staged and unstaged changes> ```

## 注意事项

- 如果不在 git 仓库中,请告知用户,并建议使用 `git init` 初始化一个。 - 对于大型仓库,获取贡献者列表可能需要一点时间——如果预计会有延迟,请提前警告用户。 - 始终注意某些信息可能具有敏感性——如果完整 URL 中包含令牌,请勿暴露。

更多产品