git-workflow
它能做什么
这项技能说明在团队项目中如何使用 Git,从撰写清晰的提交信息到管理分支。适合希望版本控制一致、可追溯的开发者。
适用场景
- ✓当你准备提交 Git 改动,并想使用规范、清晰的提交信息时。
- ✓当你需要为功能或修复创建、命名或管理分支的时候。
- ✓当你在处理拉取请求流程或合并冲突的时候。
技能链接
https://github.com/Galaxy-Dawn/claude-scholar/blob/main/skills/git-workflow/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我为修复验证码刷新 bug 的改动写一条规范的提交信息。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会遵循项目对提交类型、范围和标题的规则,并使用清晰的分支和合并做法,让历史记录便于追溯。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Git Workflow Standards
This document defines the project's Git usage standards, including commit message format, branch management strategy, workflows, merge strategies, and more. Following these standards improves collaboration efficiency, enables traceability, supports automation, and reduces conflicts.
Commit Message Standards
The project follows the Conventional Commits specification:
<type>(<scope>): <subject>
<body>
<footer>
Type Reference
| Type | Description | Example |
|---|---|---|
feat |
New feature | feat(user): add user export functionality |
fix |
Bug fix | fix(login): fix captcha not refreshing |
docs |
Documentation update | docs(api): update API documentation |
refactor |
Refactoring | refactor(utils): refactor utility functions |
perf |
Performance improvement | perf(list): optimize list performance |
test |
Test related | test(user): add unit tests |
chore |
Other changes | chore: update dependency versions |
Subject Rules
- Start with a verb: add, fix, update, remove, optimize
- No more than 50 characters
- No period at the end
For more detailed conventions and examples, see references/commit-conventions.md.
Branch Management Strategy
Branch Types
| Branch Type | Naming Convention | Description | Lifecycle |
|---|---|---|---|
| master | master |
Main branch, releasable state | Permanent |
| develop | develop |
Development branch, latest integrated code | Permanent |
| feature | feature/feature-name |
Feature branch | Delete after completion |
| bugfix | bugfix/issue-description |
Bug fix branch | Delete after fix |
| hotfix | hotfix/issue-description |
Emergency fix branch | Delete after fix |
| release | release/version-number |
Release branch | Delete after release |
Branch Naming Examples
feature/user-management # User management feature
feature/123-add-export # Issue-linked feature
bugfix/login-error # Login error fix
hotfix/security-vulnerability # Security vulnerability fix
release/v1.0.0 # Version release
Branch Protection Rules
master branch:
- No direct pushes allowed
- Must merge via Pull Request
- Must pass CI checks
- Requires at least one Code Review approval
develop branch:
- Direct pushes restricted
- Pull Request merges recommended
- Must pass CI checks
For detailed branch strategies and workflows, see references/branching-strategies.md.
Workflows
Daily Development Workflow
# 1. Sync latest code
git checkout develop
git pull origin develop
# 2. Create feature branch
git checkout -b feature/user-management
# 3. Develop and commit
git add .
git commit -m "feat(user): add user list page"
# 4. Push to remote
git push -u origin feature/user-management
# 5. Create Pull Request and request Code Review
# 6. Merge to develop (via PR)
# 7. Delete feature branch
git branch -d feature/user-management
git push origin -d feature/user-management
Hotfix Workflow
# 1. Create fix branch from master
git checkout master
git pull origin master
git checkout -b hotfix/critical-bug
# 2. Fix and commit
git add .
git commit -m "fix(auth): fix authentication bypass vulnerability"
# 3. Merge to master
git checkout master
git merge --no-ff hotfix/critical-bug
git tag -a v1.0.1 -m "hotfix: fix authentication bypass vulnerability"
git push origin master --tags
# 4. Sync to develop
git checkout develop
git merge --no-ff hotfix/critical-bug
git push origin develop
Release Workflow
# 1. Create release branch
git checkout develop
git checkout -b release/v1.0.0
# 2. Update version numbers and documentation
# 3. Commit version update
git add .
git commit -m "chore(release): prepare release v1.0.0"
# 4. Merge to master
git checkout master
git merge --no-ff release/v1.0.0
git tag -a v1.0.0 -m "release: v1.0.0 official release"
git push origin master --tags
# 5. Sync to develop
git checkout develop
git merge --no-ff release/v1.0.0
git push origin develop
Merge Strategy
Merge vs Rebase
| Feature | Merge | Rebase |
|---|---|---|
| History | Preserves complete history | Linear history |
| Use case | Public branches | Private branches |
| Recommended for | Merging to main branch | Syncing upstream code |
Recommendations
- Feature branch syncing develop: Use
rebase - Feature branch merging to develop: Use
merge --no-ff
常见问题
什么是 Conventional Commits?
它是一种提交格式,包含类型、可选的范围和简短的标题,例如 fix 或 feat。
标题长度有什么规定?
标题应以动词开头,少于 50 个字符,结尾不加句号。
它涵盖合并策略吗?
涵盖。它也包括分支策略和合并方法。
详情
作者的原始描述
This skill should be used when the user asks to "create git commit", "manage branches", "follow git workflow", "use Conventional Commits", "handle merge conflicts", or asks about git branching strategies, version control best practices, pull request workflows. Provides comprehensive Git workflow guidance for team collaboration.
热度
- GitHub 星标
- 6.0k
- 排名
- #14487
- 许可证
- MIT
- 更新时间
- 2026/10/19
评论
- …
同一仓库的更多技能
agent-identifier
6.0k教你的智能体创建 Claude Code 智能体,正确编写其名称、触发描述、系统提示词和设置。
architecture-design
6.0k教你的智能体掌握机器学习项目代码的标准结构,在添加可注册组件时使用工厂和注册表模式。
bug-detective
6.0k帮你的智能体用清晰的方法找出并修复代码错误:先理解问题,收集证据,验证想法,再确认修复结果。
citation-verification
6.0k教你的智能体对照可信的学术来源检查论文中的每条引用,找出虚假或错误的参考文献。