Git 提交
- 作者仓库星标 0
- 作者仓库 Garden
License: MIT
Git Commit Skill
Write meaningful git commits using conventional commit format to improve collaboration, enable automation, and maintain clean project history.
Commit Format
<type>(<scope>): <subject>
<body>
<footer>
Commit Types
- feat: New feature for users
- fix: Bug fix for users
- docs: Documentation changes
- style: Code style (formatting, etc)
- refactor: Code restructuring
- test: Test additions/modifications
- chore: Maintenance tasks
- perf: Performance improvements
- build: Build system changes
- ci: CI configuration changes
- revert: Revert previous commit
Subject Line Rules
- Use imperative mood: "Add feature" not "Added feature"
- First letter capitalized, no period at end
- Max 50 characters
- Describe what the commit does
Body Guidelines
- Explain why the change was made
- Use bullet points for multiple changes
- Reference related issues:
Closes #123,Fixes #456 - Max 72 characters per line
Footer Elements
- Breaking changes:
BREAKING CHANGE: description - Issue references:
Closes #123,Fixes #456 - Co-authors:
Co-authored-by: name <email>
Examples
Feature with issue reference:
feat(auth): add OAuth2 support
Implement Google and GitHub authentication with JWT tokens.
Add social login buttons to UI.
Closes #123
Bug fix with explanation:
fix(api): resolve null pointer in user endpoint
Add null check for user object before accessing properties.
Root cause: Missing validation in user lookup function.
Fixes #456
Documentation update:
docs(readme): update installation instructions
Add Docker installation option.
Document required environment variables.
Workflow
- Stage selectively:
git add -p - Review changes:
git diff --cached - Write message: Follow conventional format
- Commit:
git commit -m "type(scope): subject" -m "body" - Verify:
git log --oneline -1
Automation Tools
Commitizen
Interactive commit message writing:
git add . && git cz
commitlint
Validate commit messages:
// commitlint.config.js
module.exports = {extends: ['@commitlint/config-conventional']}
Conventional Changelog
Generate changelog from commits:
conventional-changelog -p angular -i CHANGELOG.md -s
Semantic Release
Automated versioning based on commit types.
Git Hooks
commit-msg Hook
Validate commit message format in .git/hooks/commit-msg.
pre-commit Hook
Run tests and linting before commit:
npm test && npm run lint
Best Practices
- Make atomic commits - one logical change per commit
- Write meaningful subject lines
- Explain reasoning in body, not just what changed
- Reference related issues
- Note breaking changes clearly
- Use interactive staging:
git add -p - Rebase for clean history:
git rebase -i HEAD~5 - Sign important commits:
git commit -S
Quick Reference
Common Commands
git commit -m "type(scope): subject"
git commit --amend
git add -p
git rebase -i HEAD~5
git log --oneline --graph --decorate
Common Scopes
auth- Authenticationapi- API endpointsui- User interfacedb- Databasedocs- Documentation
Templates & References
See templates/ directory for:
commit-message-template.md- Complete commit templatesgit-hook-examples.md- Git hook implementations
See references/ directory for:
conventional-commits.md- Specification detailssemantic-versioning.md- Version bump mappingworkflow-best-practices.md- Team workflows
- 流狐分类
- 工程开发
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @001eander · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 需简单配置
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- Docker
- 底层运行要求
- Docker
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 读取环境变量
- 检测到的网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 Commit Format
feat: New feature for users fix: Bug fix for users docs: Documentation changes
Use imperative mood: "Add feature" not "Added feature" First letter capitalized, no period at end Max 50 characters
Explain why the change was made Use bullet points for multiple changes Reference related issues: Closes 123, Fixes 456
Breaking changes: BREAKING CHANGE: description Issue references: Closes 123, Fixes 456 Co-authors: Co-authored-by: name <email>
Feature with issue reference: Bug fix with explanation: Documentation update:
> License: MIT
# Git Commit Skill
Write meaningful git commits using conventional commit format to improve collaboration, enable automation, and maintain clean project history.
## Commit Format
```
<type>(<scope>): <subject>
<body>
<footer>
```
### Commit Types
- **feat**: New feature for users
- **fix**: Bug fix for users
- **docs**: Documentation changes
- **style**: Code style (formatting, etc)
- **refactor**: Code restructuring
- **test**: Test additions/modifications
- **chore**: Maintenance tasks
- **perf**: Performance improvements
- **build**: Build system changes
- **ci**: CI configuration changes
- **revert**: Revert previous commit
### Subject Line Rules
- Use imperative mood: "Add feature" not "Added feature"
- First letter capitalized, no period at end
- Max 50 characters
- Describe what the commit does
### Body Guidelines
- Explain **why** the change was made
- Use bullet points for multiple changes
- Reference related issues: `Closes #123`, `Fixes #456`
- Max 72 characters per line
### Footer Elements
- Breaking changes: `BREAKING CHANGE: description`
- Issue references: `Closes #123`, `Fixes #456`
- Co-authors: `Co-authored-by: name <email>`
## Examples
**Feature with issue reference:**
```
feat(auth): add OAuth2 support
Implement Google and GitHub authentication with JWT tokens.
Add social login buttons to UI.
Closes #123
```
**Bug fix with explanation:**
```
fix(api): resolve null pointer in user endpoint
Add null check for user object before accessing properties.
Root cause: Missing validation in user lookup function.
Fixes #456
```
**Documentation update:**
```
docs(readme): update installation instructions
Add Docker installation option.
Document required environment variables.
```
## Workflow
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> Commit Format → Commit Types → Subject Line Rules → Body Guidelines → Footer Elements → Examples
要点 -> feat · fix · docs · style · refactor · test · chore · perf
文件/命令 -> Closes #123 · Fixes #456 · BREAKING CHANGE: description · Co-authored-by: name <email> · git add -p · git diff --cached · git commit -m "type(scope): subject" -m "body" · git log --oneline -1
内容 SHA-256 -> e2d290c18420
方法与流程
适用与边界
原文中的明确线索
Closes #123、Fixes #456、BREAKING CHANGE: description、Co-authored-by: name <email>、git add -p、git diff --cached、git commit -m "type(scope): subject" -m "body"、git log --oneline -1