关于 gitworfkflows
Git Workflows Skill 是 Golden Armada AI Agent Fleet Platform 中用于 Git 操作的参考技能,涵盖常用命令、Git Flow 分支、提交规范、仓库工作流、GitHub CLI、忽略规则和钩子。
主要功能
- 01Git 命令参考
- 02Git Flow 分支指南
- 03分支命名与提交规范
- 04常见分支和合并工作流
- 05GitHub CLI 示例
- 06忽略规则与 Git 钩子
适用场景
- 01创建并同步功能分支
- 02压缩或撤销提交
- 03管理拉取请求和议题
- 04配置忽略规则与钩子
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ thelobbi/ claude --skill gitworfkflows安装后在 Claude Code 中输入/gitworfkflows确认已加载。
详细介绍
Git 工作流技能
为 Golden Armada AI Agent Fleet Platform 提供全面的 Git 版本控制功能。
何时使用此技能
在处理以下内容时启用此技能:
- Git 命令和操作
- 分支策略
- 提交管理
- 拉取请求和合并
- 仓库配置
快速参考
基本命令
# 状态和信息
git status
git log --oneline -10
git diff
git diff --staged
# 暂存
git add <file>
git add .
git add -p # 交互式暂存
# 提交
git commit -m "message"
git commit -am "message" # 添加并提交
git commit --amend
# 分支
git branch
git branch <name>
git checkout <branch>
git checkout -b <branch>
git switch <branch>
git switch -c <branch>
# 合并
git merge <branch>
git merge --no-ff <branch>
git rebase <branch>
# 远程
git fetch
git pull
git push
git push -u origin <branch>
分支策略(Git Flow)
main ─────●─────────────●─────────────●───────
│ │ │
release ─────┼─────●───────┼─────────────┼───────
│ │ │ │
develop ─────●─────┼───────●─────────────●───────
│ │ │ │
feature ─────●─────┘ │ │
│ │
hotfix ───────────────────●─────────────┘
分支命名
# 功能
feature/add-agent-api
feature/GA-123-user-auth
# Bug 修复
bugfix/fix-agent-timeout
bugfix/GA-456-memory-leak
# 紧急修复
hotfix/critical-security-patch
# 发布
release/v1.0.0
提交消息规范
# 格式
<type>(<scope>): <subject>
<body>
<footer>
# 类型
feat: 新功能
fix: Bug 修复
docs: 文档
style: 格式调整(不更改代码)
refactor: 代码重构
test: 添加测试
chore: 维护
# 示例
git commit -m "feat(agent): add Claude agent support"
git commit -m "fix(api): resolve timeout in task processing"
git commit -m "docs: update deployment instructions"
常见工作流
开始开发功能
git checkout develop
git pull origin develop
git checkout -b feature/new-feature
# ... work ...
git add .
git commit -m "feat: implement new feature"
git push -u origin feature/new-feature
# 创建指向 develop 的 PR
同步功能分支
git checkout develop
git pull origin develop
git checkout feature/my-feature
git rebase develop
# 如有冲突,请解决
git push --force-with-lease
合并提交
git rebase -i HEAD~3 # 交互式变基最近 3 次提交
# 将要合并的提交对应的 'pick' 改为 'squash'
撤销更改
# 撤销上次提交(保留更改)
git reset --soft HEAD~1
# 撤销上次提交(丢弃更改)
git reset --hard HEAD~1
# 撤销已暂存的更改
git restore --staged <file>
# 丢弃工作目录中的更改
git restore <file>
# 还原某次提交(创建新提交)
git revert <commit-hash>
GitHub CLI
# PR 管理
gh pr create --title "Feature: Add agent API" --body "Description"
gh pr list
gh pr checkout <number>
gh pr merge <number>
gh pr review <number> --approve
# Issue
gh issue create --title "Bug: Agent timeout" --label bug
gh issue list
gh issue close <number>
# 仓库
gh repo clone <owner>/<repo>
gh repo view --web
.gitignore 模式
# 依赖项
node_modules/
venv/
__pycache__/
# 构建产物
dist/
build/
*.egg-info/
# 环境
.env
.env.local
*.local
# IDE
.idea/
.vscode/
*.swp
# 操作系统
.DS_Store
Thumbs.db
# 日志
*.log
logs/
# 密钥(切勿提交!)
*.pem
*.key
credentials.json
Git 钩子
# .git/hooks/pre-commit
#!/bin/sh
npm run lint
npm run test
# .git/hooks/commit-msg
#!/bin/sh
if ! grep -qE "^(feat|fix|docs|style|refactor|test|chore)(\(.+\))?: .{1,50}" "$1"; then
echo "无效的提交消息格式"
exit 1
fi
\`\`\`
评论
支持 Markdown