[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AM1M7BAJAS336TNRW55D5D":3,"skill-same:01M7AM1M7BAJAS336TNRW55D5D":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7AM1M7BAJAS336TNRW55D5D","git-workflow",null,"Git工作流模式，包括分支策略、提交约定、合并与变基、冲突解决以及适用于各种规模团队的协作开发最佳实践。","Cyrilthetecchieee\u002Fcyril-code-","Cyrilthetecchieee","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F219787998?v=4","01M7AF0MMMKRAA0H61XMJPV92H","Julian Cyril D ","01M7AF0MQ10AVG6QJQ1C2BC0F5",2,"MIT","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fdocs\u002Fzh-CN\u002Fskills\u002Fgit-workflow\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: git-workflow\ndescription: Git工作流模式，包括分支策略、提交约定、合并与变基、冲突解决以及适用于各种规模团队的协作开发最佳实践。\norigin: ECC\n---\n\n# Git 工作流模式\n\nGit 版本控制、分支策略与协作开发的最佳实践。\n\n## 何时启用\n\n* 为新项目设置 Git 工作流\n* 决定分支策略（GitFlow、主干开发、GitHub Flow）\n* 编写提交信息和 PR 描述\n* 解决合并冲突\n* 管理发布和版本标签\n* 让新团队成员熟悉 Git 实践\n\n## 分支策略\n\n### GitHub Flow（简单，推荐大多数场景使用）\n\n最适合持续部署以及中小型团队。\n\n```\nmain (protected, always deployable)\n  │\n  ├── feature\u002Fuser-auth      → PR → merge to main\n  ├── feature\u002Fpayment-flow   → PR → merge to main\n  └── fix\u002Flogin-bug          → PR → merge to main\n```\n\n**规则：**\n\n* `main` 始终可部署\n* 从 `main` 创建功能分支\n* 准备就绪后发起 Pull Request\n* 审核通过且 CI 通过后，合并到 `main`\n* 合并后立即部署\n\n### 主干开发（高速度团队）\n\n最适合具备强大 CI\u002FCD 和功能开关的团队。\n\n```\nmain (主干)\n  │\n  ├── 短期功能分支（最长1-2天）\n  ├── 短期功能分支\n  └── 短期功能分支\n```\n\n**规则：**\n\n* 所有人直接提交到 `main` 或使用极短生命周期的分支\n* 功能开关隐藏未完成的工作\n* 合并前必须通过 CI\n* 每天多次部署\n\n### GitFlow（复杂，基于发布周期）\n\n适合计划性发布和企业级项目。\n\n```\nmain (生产发布版本)\n  │\n  └── develop (集成分支)\n        │\n        ├── feature\u002Fuser-auth\n        ├── feature\u002Fpayment\n        │\n        ├── release\u002F1.0.0    → 合并到 main 和 develop\n        │\n        └── hotfix\u002Fcritical  → 合并到 main 和 develop\n```\n\n**规则：**\n\n* `main` 仅包含生产就绪代码\n* `develop` 是集成分支\n* 功能分支从 `develop` 创建，合并回 `develop`\n* 发布分支从 `develop` 创建，合并到 `main` 和 `develop`\n* 热修复分支从 `main` 创建，合并到 `main` 和 `develop`\n\n### 何时使用哪种策略\n\n| 策略 | 团队规模 | 发布频率 | 最佳适用场景 |\n|----------|-----------|-----------------|----------|\n| GitHub Flow | 任意 | 持续 | SaaS、Web 应用、初创公司 |\n| 主干开发 | 5 人以上有经验 | 每天多次 | 高速度团队、功能开关 |\n| GitFlow | 10 人以上 | 计划性 | 企业、受监管行业 |\n\n## 提交信息\n\n### 常规提交格式\n\n```\n\u003Ctype>(\u003Cscope>): \u003Csubject>\n\n[optional body]\n\n[optional footer(s)]\n```\n\n### 类型\n\n| 类型 | 用途 | 示例 |\n|------|---------|---------|\n| `feat` | 新功能 | `feat(auth): add OAuth2 login` |\n| `fix` | 错误修复 | `fix(api): handle null response in user endpoint` |\n| `docs` | 文档 | `docs(readme): update installation instructions` |\n| `style` | 格式调整，无代码变更 | `style: fix indentation in login component` |\n| `refactor` | 代码重构 | `refactor(db): extract connection pool to module` |\n| `test` | 添加\u002F更新测试 | `test(auth): add unit tests for token validation` |\n| `chore` | 维护任务 | `chore(deps): update dependencies` |\n| `perf` | 性能改进 | `perf(query): add index to users table` |\n| `ci` | CI\u002FCD 变更 | `ci: add PostgreSQL service to test workflow` |\n| `revert` | 回滚之前的提交 | `revert: revert \"feat(auth): add OAuth2 login\"` |\n\n### 好与坏的示例\n\n```\n# 不好：模糊，无上下文\ngit commit -m \"修复了一些东西\"\ngit commit -m \"更新\"\ngit commit -m \"进行中\"\n\n# 好：清晰，具体，解释原因\ngit commit -m \"fix(api): 在 503 服务不可用时重试请求\n\n外部 API 在高峰时段偶尔会返回 503 错误。\n添加了指数退避重试逻辑，最多尝试 3 次。\n\n关闭 #123\"\n```\n\n### 提交信息模板\n\n在仓库根目录创建 `.gitmessage`：\n\n```\n# \u003Ctype>(\u003Cscope>): \u003Csubject>\n# # 类型：feat, fix, docs, style, refactor, test, chore, perf, ci, revert\n# 范围：api, ui, db, auth 等\n# 主题：祈使语气，无句号，最多50个字符\n#\n# [可选正文] - 解释原因，而非内容\n# [可选脚注] - 破坏性变更，关闭 #issue\n```\n\n启用方式：`git config commit.template .gitmessage`\n\n## 合并 vs 变基\n\n### 合并（保留历史）\n\n```bash\n# Creates a merge commit\ngit checkout main\ngit merge feature\u002Fuser-auth\n\n# Result:\n# *   merge commit\n# |\\\n# | * feature commits\n# |\u002F\n# * main commits\n```\n\n**适用场景：**\n\n* 将功能分支合并到 `main`\n* 希望保留完整历史\n* 多人共同开发该分支\n* 分支已推送，其他人可能基于它开展工作\n\n### 变基（线性历史）\n\n```bash\n# Rewrites feature commits onto target branch\ngit checkout feature\u002Fuser-auth\ngit rebase main\n\n# Result:\n# * feature commits (rewritten)\n# * main commits\n```\n\n**适用场景：**\n\n* 用最新的 `main` 更新本地功能分支\n* 希望获得线性、干净的历史\n* 分支仅存在于本地（未推送）\n* 只有你一个人在该分支上工作\n\n### 变基工作流\n\n```bash\n# Update feature branch with latest main (before PR)\ngit checkout feature\u002Fuser-auth\ngit fetch origin\ngit rebase origin\u002Fmain\n\n# Fix any conflicts\n# Tests should still pass\n\n# Force push (only if you're the only contributor)\ngit push --force-with-lease origin feature\u002Fuser-auth\n```\n\n### 何时不应变基\n\n```\n# 切勿变基以下分支：\n- 已推送至共享仓库的分支\n- 他人已基于其工作的分支\n- 受保护分支（main、develop）\n- 已合并的分支\n\n# 原因：变基会重写历史，破坏他人的工作\n```\n\n## Pull Request 工作流\n\n### PR 标题格式\n\n```\n\u003Ctype>(\u003Cscope>): \u003Cdescription>\n\n示例：\nfeat(auth): add SSO support for enterprise users\nfix(api): resolve race condition in order processing\ndocs(api): add OpenAPI specification for v2 endpoints\n```\n\n### PR 描述模板\n\n```markdown\n## 内容\n\n简要描述此 PR 的内容。\n\n## 动机\n\n解释动机和背景。\n\n## 实现方式\n\n值得强调的关键实现细节。\n\n## 测试\n\n- [ ] 新增\u002F更新单元测试\n- [ ] 新增\u002F更新集成测试\n- [ ] 执行手动测试\n\n## 截图（如适用）\n\nUI 变更的前后对比截图。\n\n## 检查清单\n\n- [ ] 代码遵循项目风格指南\n- [ ] 完成自我审查\n- [ ] 为复杂逻辑添加注释\n- [ ] 更新文档\n- [ ] 未引入新警告\n- [ ] 测试在本地通过\n- [ ] 关联问题已链接\n\n关闭 #123\n```\n\n### 代码审查清单\n\n**审查者：**\n\n* \\[ ] 代码是否解决了所述问题？\n* \\[ ] 是否处理了所有边界情况？\n* \\[ ] 代码是否可读且易于维护？\n* \\[ ] 是否有足够的测试？\n* \\[ ] 是否存在安全问题？\n* \\[ ] 提交历史是否干净（必要时已压缩）？\n\n**作者：**\n\n* \\[ ] 在请求审查前已完成自我审查\n* \\[ ] CI 通过（测试、lint、类型检查）\n* \\[ ] PR 大小合理（理想情况下 \u003C500 行）\n* \\[ ] 与单个功能\u002F修复相关\n* \\[ ] 描述清晰解释了变更内容\n\n## 冲突解决\n\n### 识别冲突\n\n```bash\n# Check for conflicts before merge\ngit checkout main\ngit merge feature\u002Fuser-auth --no-commit --no-ff\n\n# If conflicts, Git will show:\n# CONFLICT (content): Merge conflict in src\u002Fauth\u002Flogin.ts\n# Automatic merge failed; fix conflicts and then commit the result.\n```\n\n### 解决冲突\n\n```bash\n# See conflicted files\ngit status\n\n# View conflict markers in file\n# \u003C\u003C\u003C\u003C\u003C\u003C\u003C HEAD\n# content from main\n# =======\n# content from feature branch\n# >>>>>>> feature\u002Fuser-auth\n\n# Option 1: Manual resolution\n# Edit file, remove markers, keep correct content\n\n# Option 2: Use merge tool\ngit mergetool\n\n# Option 3: Accept one side\ngit checkout --ours src\u002Fauth\u002Flogin.ts    # Keep main version\ngit checkout --theirs src\u002Fauth\u002Flogin.ts  # Keep feature version\n\n# After resolving, stage and commit\ngit add src\u002Fauth\u002Flogin.ts\ngit commit\n```\n\n### 冲突预防策略\n\n```bash\n# 1. Keep feature branches small and short-lived\n# 2. Rebase frequently onto main\ngit checkout feature\u002Fuser-auth\ngit fetch origin\ngit rebase origin\u002Fmain\n\n# 3. Communicate with team about touching shared files\n# 4. Use feature flags instead of long-lived branches\n# 5. Review and merge PRs promptly\n```\n\n## 分支管理\n\n### 命名规范\n\n```\n# 功能分支\nfeature\u002Fuser-authentication\nfeature\u002FJIRA-123-payment-integration\n\n# 错误修复\nfix\u002Flogin-redirect-loop\nfix\u002F456-null-pointer-exception\n\n# 热修复（生产问题）\nhotfix\u002Fcritical-security-patch\nhotfix\u002Fdatabase-connection-leak\n\n# 发布版本\nrelease\u002F1.2.0\nrelease\u002F2024-01-hotfix\n\n# 实验\u002F概念验证\nexperiment\u002Fnew-caching-strategy\npoc\u002Fgraphql-migration\n```\n\n### 分支清理\n\n```bash\n# Delete local branches that are merged\ngit branch --merged main | grep -v \"^\\*\\|main\" | xargs -n 1 git branch -d\n\n# Delete remote-tracking references for deleted remote branches\ngit fetch -p\n\n# Delete local branch\ngit branch -d feature\u002Fuser-auth  # Safe delete (only if merged)\ngit branch -D feature\u002Fuser-auth  # Force delete\n\n# Delete remote branch\ngit push origin --delete feature\u002Fuser-auth\n```\n\n### 暂存工作流\n\n```bash\n# Save work in progress\ngit stash push -m \"WIP: user authentication\"\n\n# List stashes\ngit stash list\n\n# Apply most recent stash\ngit stash pop\n\n# Apply specific stash\ngit stash apply stash@{2}\n\n# Drop stash\ngit stash drop stash@{0}\n```\n\n## 发布管理\n\n### 语义化版本\n\n```\nMAJOR.MINOR.PATCH\n\nMAJOR：破坏性变更\nMINOR：新功能，向后兼容\nPATCH：错误修复，向后兼容\n\n示例：\n1.0.0 → 1.0.1（补丁：错误修复）\n1.0.1 → 1.1.0（次要：新功能）\n1.1.0 → 2.0.0（主要：破坏性变更）\n```\n\n### 创建发布\n\n```bash\n# Create annotated tag\ngit tag -a v1.2.0 -m \"Release v1.2.0\n\nFeatures:\n- Add user authentication\n- Implement password reset\n\nFixes:\n- Resolve login redirect issue\n\nBreaking Changes:\n- None\"\n\n# Push tag to remote\ngit push origin v1.2.0\n\n# List tags\ngit tag -l\n\n# Delete tag\ngit tag -d v1.2.0\ngit push origin --delete v1.2.0\n```\n\n### 变更日志生成\n\n```bash\n# Generate changelog from commits\ngit log v1.1.0..v1.2.0 --oneline --no-merges\n\n# Or use conventional-changelog\nnpx conventional-changelog -i CHANGELOG.md -s\n```\n\n## Git 配置\n\n### 基本配置\n\n```bash\n# User identity\ngit config --global user.name \"Your Name\"\ngit config --global user.email \"your@email.com\"\n\n# Default branch name\ngit config --global init.defaultBranch main\n\n# Pull behavior (rebase instead of merge)\ngit config --global pull.rebase true\n\n# Push behavior (push current branch only)\ngit config --global push.default current\n\n# Auto-correct typos\ngit config --global help.autocorrect 1\n\n# Better diff algorithm\ngit config --global diff.algorithm histogram\n\n# Color output\ngit config --global color.ui auto\n```\n\n### 实用别名\n\n```bash\n# Add to ~\u002F.gitconfig\n[alias]\n    co = checkout\n    br = branch\n    ci = commit\n    st = status\n    unstage = reset HEAD --\n    last = log -1 HEAD\n    visual = log --oneline --graph --all\n    amend = commit --amend --no-edit\n    wip = commit -m \"WIP\"\n    undo = reset --soft HEAD~1\n    contributors = shortlog -sn\n```\n\n### Gitignore 模式\n\n```gitignore\n# Dependencies\nnode_modules\u002F\nvendor\u002F\n\n# Build outputs\ndist\u002F\nbuild\u002F\n*.o\n*.exe\n\n# Environment files\n.env\n.env.local\n.env.*.local\n\n# IDE\n.idea\u002F\n.vscode\u002F\n*.swp\n*.swo\n\n# OS files\n.DS_Store\nThumbs.db\n\n# Logs\n*.log\nlogs\u002F\n\n# Test coverage\ncoverage\u002F\n\n# Cache\n.cache\u002F\n*.tsbuildinfo\n```\n\n## 常见工作流\n\n### 开始新功能\n\n```bash\n# 1. Update main branch\ngit checkout main\ngit pull origin main\n\n# 2. Create feature branch\ngit checkout -b feature\u002Fuser-auth\n\n# 3. Make changes and commit\ngit add .\ngit commit -m \"feat(auth): implement OAuth2 login\"\n\n# 4. Push to remote\ngit push -u origin feature\u002Fuser-auth\n\n# 5. Create Pull Request on GitHub\u002FGitLab\n```\n\n### 用新变更更新 PR\n\n```bash\n# 1. Make additional changes\ngit add .\ngit commit -m \"feat(auth): add error handling\"\n\n# 2. Push updates\ngit push origin feature\u002Fuser-auth\n```\n\n### 同步 Fork 与上游\n\n```bash\n# 1. Add upstream remote (once)\ngit remote add upstream https:\u002F\u002Fgithub.com\u002Foriginal\u002Frepo.git\n\n# 2. Fetch upstream\ngit fetch upstream\n\n# 3. Merge upstream\u002Fmain into your main\ngit checkout main\ngit merge upstream\u002Fmain\n\n# 4. Push to your fork\ngit push origin main\n```\n\n### 撤销错误操作\n\n```bash\n# Undo last commit (keep changes)\ngit reset --soft HEAD~1\n\n# Undo last commit (discard changes)\ngit reset --hard HEAD~1\n\n# Undo last commit pushed to remote\ngit revert HEAD\ngit push origin main\n\n# Undo specific file changes\ngit checkout HEAD -- path\u002Fto\u002Ffile\n\n# Fix last commit message\ngit commit --amend -m \"New message\"\n\n# Add forgotten file to last commit\ngit add forgotten-file\ngit commit --amend --no-edit\n```\n\n## Git 钩子\n\n### 预提交钩子\n\n```bash\n#!\u002Fbin\u002Fbash\n# .git\u002Fhooks\u002Fpre-commit\n\n# Run linting\nnpm run lint || exit 1\n\n# Run tests\nnpm test || exit 1\n\n# Check for secrets\nif git diff --cached | grep -E '(password|api_key|secret)'; then\n    echo \"Possible secret detected. Commit aborted.\"\n    exit 1\nfi\n```\n\n### 预推送钩子\n\n```bash\n#!\u002Fbin\u002Fbash\n# .git\u002Fhooks\u002Fpre-push\n\n# Run full test suite\nnpm run test:all || exit 1\n\n# Check for console.log statements\nif git diff origin\u002Fmain | grep -E 'console\\.log'; then\n    echo \"Remove console.log statements before pushing.\"\n    exit 1\nfi\n```\n\n## 反模式\n\n```\n# 错误：直接提交到主分支\ngit checkout main\ngit commit -m \"修复bug\"\n\n# 正确：使用功能分支和拉取请求\n\n# 错误：提交机密信息\ngit add .env  # 包含API密钥\n\n# 正确：添加到.gitignore，使用环境变量\n\n# 错误：巨大的拉取请求（超过1000行）\n# 正确：拆分为更小、更聚焦的拉取请求\n\n# 错误：\"更新\"类提交信息\ngit commit -m \"更新\"\ngit commit -m \"修复\"\n\n# 正确：描述性信息\ngit commit -m \"fix(auth): 解决登录后的重定向循环问题\"\n\n# 错误：重写公共历史\ngit push --force origin main\n\n# 正确：对公共分支使用回退\ngit revert HEAD\n\n# 错误：长期存在的功能分支（数周\u002F数月）\n# 正确：保持分支短期（数天），频繁变基\n\n# 错误：提交生成的文件\ngit add dist\u002F\ngit add node_modules\u002F\n\n# 正确：添加到.gitignore\n```\n\n## 快速参考\n\n| 任务 | 命令 |\n|------|---------|\n| 创建分支 | `git checkout -b feature\u002Fname` |\n| 切换分支 | `git checkout branch-name` |\n| 删除分支 | `git branch -d branch-name` |\n| 合并分支 | `git merge branch-name` |\n| 变基分支 | `git rebase main` |\n| 查看历史 | `git log --oneline --graph` |\n| 查看变更 | `git diff` |\n| 暂存变更 | `git add .` 或 `git add -p` |\n| 提交 | `git commit -m \"message\"` |\n| 推送 | `git push origin branch-name` |\n| 拉取 | `git pull origin branch-name` |\n| 暂存 | `git stash push -m \"message\"` |\n| 撤销上次提交 | `git reset --soft HEAD~1` |\n| 回滚提交 | `git revert HEAD` |\n","# Git 工作流模式\n\nGit 版本控制、分支策略与协作开发的最佳实践。\n\n## 何时启用\n\n* 为新项目设置 Git 工作流\n* 决定分支策略（GitFlow、主干开发、GitHub Flow）\n* 编写提交信息和 PR 描述\n* 解决合并冲突\n* 管理发布和版本标签\n* 让新团队成员熟悉 Git 实践\n\n## 分支策略\n\n### GitHub Flow（简单，推荐大多数场景使用）\n\n最适合持续部署以及中小型团队。\n\n```\nmain (protected, always deployable)\n  │\n  ├── feature\u002Fuser-auth      → PR → merge to main\n  ├── feature\u002Fpayment-flow   → PR → merge to main\n  └── fix\u002Flogin-bug          → PR → merge to main\n```\n\n**规则：**\n\n* `main` 始终可部署\n* 从 `main` 创建功能分支\n* 准备就绪后发起 Pull Request\n* 审核通过且 CI 通过后，合并到 `main`\n* 合并后立即部署\n\n### 主干开发（高速度团队）\n\n最适合具备强大 CI\u002FCD 和功能开关的团队。\n\n```\nmain (主干)\n  │\n  ├── 短期功能分支（最长1-2天）\n  ├── 短期功能分支\n  └── 短期功能分支\n```\n\n**规则：**\n\n* 所有人直接提交到 `main` 或使用极短生命周期的分支\n* 功能开关隐藏未完成的工作\n* 合并前必须通过 CI\n* 每天多次部署\n\n### GitFlow（复杂，基于发布周期）\n\n适合计划性发布和企业级项目。\n\n```\nmain (生产发布版本)\n  │\n  └── develop (集成分支)\n        │\n        ├── feature\u002Fuser-auth\n        ├── feature\u002Fpayment\n        │\n        ├── release\u002F1.0.0    → 合并到 main 和 develop\n        │\n        └── hotfix\u002Fcritical  → 合并到 main 和 develop\n```\n\n**规则：**\n\n* `main` 仅包含生产就绪代码\n* `develop` 是集成分支\n* 功能分支从 `develop` 创建，合并回 `develop`\n* 发布分支从 `develop` 创建，合并到 `main` 和 `develop`\n* 热修复分支从 `main` 创建，合并到 `main` 和 `develop`\n\n### 何时使用哪种策略\n\n| 策略 | 团队规模 | 发布频率 | 最佳适用场景 |\n|----------|-----------|-----------------|----------|\n| GitHub Flow | 任意 | 持续 | SaaS、Web 应用、初创公司 |\n| 主干开发 | 5 人以上有经验 | 每天多次 | 高速度团队、功能开关 |\n| GitFlow | 10 人以上 | 计划性 | 企业、受监管行业 |\n\n## 提交信息\n\n### 常规提交格式\n\n```\n\u003Ctype>(\u003Cscope>): \u003Csubject>\n\n[optional body]\n\n[optional footer(s)]\n```\n\n### 类型\n\n| 类型 | 用途 | 示例 |\n|------|---------|---------|\n| `feat` | 新功能 | `feat(auth): add OAuth2 login` |\n| `fix` | 错误修复 | `fix(api): handle null response in user endpoint` |\n| `docs` | 文档 | `docs(readme): update installation instructions` |\n| `style` | 格式调整，无代码变更 | `style: fix indentation in login component` |\n| `refactor` | 代码重构 | `refactor(db): extract connection pool to module` |\n| `test` | 添加\u002F更新测试 | `test(auth): add unit tests for token validation` |\n| `chore` | 维护任务 | `chore(deps): update dependencies` |\n| `perf` | 性能改进 | `perf(query): add index to users table` |\n| `ci` | CI\u002FCD 变更 | `ci: add PostgreSQL service to test workflow` |\n| `revert` | 回滚之前的提交 | `revert: revert \"feat(auth): add OAuth2 login\"` |\n\n### 好与坏的示例\n\n```\n# 不好：模糊，无上下文\ngit commit -m \"修复了一些东西\"\ngit commit -m \"更新\"\ngit commit -m \"进行中\"\n\n# 好：清晰，具体，解释原因\ngit commit -m \"fix(api): 在 503 服务不可用时重试请求\n\n外部 API 在高峰时段偶尔会返回 503 错误。\n添加了指数退避重试逻辑，最多尝试 3 次。\n\n关闭 #123\"\n```\n\n### 提交信息模板\n\n在仓库根目录创建 `.gitmessage`：\n\n```\n# \u003Ctype>(\u003Cscope>): \u003Csubject>\n# # 类型：feat, fix, docs, style, refactor, test, chore, perf, ci, revert\n# 范围：api, ui, db, auth 等\n# 主题：祈使语气，无句号，最多50个字符\n#\n# [可选正文] - 解释原因，而非内容\n# [可选脚注] - 破坏性变更，关闭 #issue\n```\n\n启用方式：`git config commit.template .gitmessage`\n\n## 合并 vs 变基\n\n### 合并（保留历史）\n\n```bash\n# Creates a merge commit\ngit checkout main\ngit merge feature\u002Fuser-auth\n\n# Result:\n# *   merge commit\n# |\\\n# | * feature commits\n# |\u002F\n# * main commits\n```\n\n**适用场景：**\n\n* 将功能分支合并到 `main`\n* 希望保留完整历史\n* 多人共同开发该分支\n* 分支已推送，其他人可能基于它开展工作\n\n### 变基（线性历史）\n\n```bash\n# Rewrites feature commits onto target branch\ngit checkout feature\u002Fuser-auth\ngit rebase main\n\n# Result:\n# * feature commits (rewritten)\n# * main commits\n```\n\n**适用场景：**\n\n* 用最新的 `main` 更新本地功能分支\n* 希望获得线性、干净的历史\n* 分支仅存在于本地（未推送）\n* 只有你一个人在该分支上工作\n\n### 变基工作流\n\n```bash\n# Update feature branch with latest main (before PR)\ngit checkout feature\u002Fuser-auth\ngit fetch origin\ngit rebase origin\u002Fmain\n\n# Fix any conflicts\n# Tests should still pass\n\n# Force push (only if you're the only contributor)\ngit push --force-with-lease origin feature\u002Fuser-auth\n```\n\n### 何时不应变基\n\n```\n# 切勿变基以下分支：\n- 已推送至共享仓库的分支\n- 他人已基于其工作的分支\n- 受保护分支（main、develop）\n- 已合并的分支\n\n# 原因：变基会重写历史，破坏他人的工作\n```\n\n## Pull Request 工作流\n\n### PR 标题格式\n\n```\n\u003Ctype>(\u003Cscope>): \u003Cdescription>\n\n示例：\nfeat(auth): add SSO support for enterprise users\nfix(api): resolve race condition in order processing\ndocs(api): add OpenAPI specification for v2 endpoints\n```\n\n### PR 描述模板\n\n```markdown\n## 内容\n\n简要描述此 PR 的内容。\n\n## 动机\n\n解释动机和背景。\n\n## 实现方式\n\n值得强调的关键实现细节。\n\n## 测试\n\n- [ ] 新增\u002F更新单元测试\n- [ ] 新增\u002F更新集成测试\n- [ ] 执行手动测试\n\n## 截图（如适用）\n\nUI 变更的前后对比截图。\n\n## 检查清单\n\n- [ ] 代码遵循项目风格指南\n- [ ] 完成自我审查\n- [ ] 为复杂逻辑添加注释\n- [ ] 更新文档\n- [ ] 未引入新警告\n- [ ] 测试在本地通过\n- [ ] 关联问题已链接\n\n关闭 #123\n```\n\n### 代码审查清单\n\n**审查者：**\n\n* \\[ ] 代码是否解决了所述问题？\n* \\[ ] 是否处理了所有边界情况？\n* \\[ ] 代码是否可读且易于维护？\n* \\[ ] 是否有足够的测试？\n* \\[ ] 是否存在安全问题？\n* \\[ ] 提交历史是否干净（必要时已压缩）？\n\n**作者：**\n\n* \\[ ] 在请求审查前已完成自我审查\n* \\[ ] CI 通过（测试、lint、类型检查）\n* \\[ ] PR 大小合理（理想情况下 \u003C500 行）\n* \\[ ] 与单个功能\u002F修复相关\n* \\[ ] 描述清晰解释了变更内容\n\n## 冲突解决\n\n### 识别冲突\n\n```bash\n# Check for conflicts before merge\ngit checkout main\ngit merge feature\u002Fuser-auth --no-commit --no-ff\n\n# If conflicts, Git will show:\n# CONFLICT (content): Merge conflict in src\u002Fauth\u002Flogin.ts\n# Automatic merge failed; fix conflicts and then commit the result.\n```\n\n### 解决冲突\n\n```bash\n# See conflicted files\ngit status\n\n# View conflict markers in file\n# \u003C\u003C\u003C\u003C\u003C\u003C\u003C HEAD\n# content from main\n# =======\n# content from feature branch\n# >>>>>>> feature\u002Fuser-auth\n\n# Option 1: Manual resolution\n# Edit file, remove markers, keep correct content\n\n# Option 2: Use merge tool\ngit mergetool\n\n# Option 3: Accept one side\ngit checkout --ours src\u002Fauth\u002Flogin.ts    # Keep main version\ngit checkout --theirs src\u002Fauth\u002Flogin.ts  # Keep feature version\n\n# After resolving, stage and commit\ngit add src\u002Fauth\u002Flogin.ts\ngit commit\n```\n\n### 冲突预防策略\n\n```bash\n# 1. Keep feature branches small and short-lived\n# 2. Rebase frequently onto main\ngit checkout feature\u002Fuser-auth\ngit fetch origin\ngit rebase origin\u002Fmain\n\n# 3. Communicate with team about touching shared files\n# 4. Use feature flags instead of long-lived branches\n# 5. Review and merge PRs promptly\n```\n\n## 分支管理\n\n### 命名规范\n\n```\n# 功能分支\nfeature\u002Fuser-authentication\nfeature\u002FJIRA-123-payment-integration\n\n# 错误修复\nfix\u002Flogin-redirect-loop\nfix\u002F456-null-pointer-exception\n\n# 热修复（生产问题）\nhotfix\u002Fcritical-security-patch\nhotfix\u002Fdatabase-connection-leak\n\n# 发布版本\nrelease\u002F1.2.0\nrelease\u002F2024-01-hotfix\n\n# 实验\u002F概念验证\nexperiment\u002Fnew-caching-strategy\npoc\u002Fgraphql-migration\n```\n\n### 分支清理\n\n```bash\n# Delete local branches that are merged\ngit branch --merged main | grep -v \"^\\*\\|main\" | xargs -n 1 git branch -d\n\n# Delete remote-tracking references for deleted remote branches\ngit fetch -p\n\n# Delete local branch\ngit branch -d feature\u002Fuser-auth  # Safe delete (only if merged)\ngit branch -D feature\u002Fuser-auth  # Force delete\n\n# Delete remote branch\ngit push origin --delete feature\u002Fuser-auth\n```\n\n### 暂存工作流\n\n```bash\n# Save work in progress\ngit stash push -m \"WIP: user authentication\"\n\n# List stashes\ngit stash list\n\n# Apply most recent stash\ngit stash pop\n\n# Apply specific stash\ngit stash apply stash@{2}\n\n# Drop stash\ngit stash drop stash@{0}\n```\n\n## 发布管理\n\n### 语义化版本\n\n```\nMAJOR.MINOR.PATCH\n\nMAJOR：破坏性变更\nMINOR：新功能，向后兼容\nPATCH：错误修复，向后兼容\n\n示例：\n1.0.0 → 1.0.1（补丁：错误修复）\n1.0.1 → 1.1.0（次要：新功能）\n1.1.0 → 2.0.0（主要：破坏性变更）\n```\n\n### 创建发布\n\n```bash\n# Create annotated tag\ngit tag -a v1.2.0 -m \"Release v1.2.0\n\nFeatures:\n- Add user authentication\n- Implement password reset\n\nFixes:\n- Resolve login redirect issue\n\nBreaking Changes:\n- None\"\n\n# Push tag to remote\ngit push origin v1.2.0\n\n# List tags\ngit tag -l\n\n# Delete tag\ngit tag -d v1.2.0\ngit push origin --delete v1.2.0\n```\n\n### 变更日志生成\n\n```bash\n# Generate changelog from commits\ngit log v1.1.0..v1.2.0 --oneline --no-merges\n\n# Or use conventional-changelog\nnpx conventional-changelog -i CHANGELOG.md -s\n```\n\n## Git 配置\n\n### 基本配置\n\n```bash\n# User identity\ngit config --global user.name \"Your Name\"\ngit config --global user.email \"your@email.com\"\n\n# Default branch name\ngit config --global init.defaultBranch main\n\n# Pull behavior (rebase instead of merge)\ngit config --global pull.rebase true\n\n# Push behavior (push current branch only)\ngit config --global push.default current\n\n# Auto-correct typos\ngit config --global help.autocorrect 1\n\n# Better diff algorithm\ngit config --global diff.algorithm histogram\n\n# Color output\ngit config --global color.ui auto\n```\n\n### 实用别名\n\n```bash\n# Add to ~\u002F.gitconfig\n[alias]\n    co = checkout\n    br = branch\n    ci = commit\n    st = status\n    unstage = reset HEAD --\n    last = log -1 HEAD\n    visual = log --oneline --graph --all\n    amend = commit --amend --no-edit\n    wip = commit -m \"WIP\"\n    undo = reset --soft HEAD~1\n    contributors = shortlog -sn\n```\n\n### Gitignore 模式\n\n```gitignore\n# Dependencies\nnode_modules\u002F\nvendor\u002F\n\n# Build outputs\ndist\u002F\nbuild\u002F\n*.o\n*.exe\n\n# Environment files\n.env\n.env.local\n.env.*.local\n\n# IDE\n.idea\u002F\n.vscode\u002F\n*.swp\n*.swo\n\n# OS files\n.DS_Store\nThumbs.db\n\n# Logs\n*.log\nlogs\u002F\n\n# Test coverage\ncoverage\u002F\n\n# Cache\n.cache\u002F\n*.tsbuildinfo\n```\n\n## 常见工作流\n\n### 开始新功能\n\n```bash\n# 1. Update main branch\ngit checkout main\ngit pull origin main\n\n# 2. Create feature branch\ngit checkout -b feature\u002Fuser-auth\n\n# 3. Make changes and commit\ngit add .\ngit commit -m \"feat(auth): implement OAuth2 login\"\n\n# 4. Push to remote\ngit push -u origin feature\u002Fuser-auth\n\n# 5. Create Pull Request on GitHub\u002FGitLab\n```\n\n### 用新变更更新 PR\n\n```bash\n# 1. Make additional changes\ngit add .\ngit commit -m \"feat(auth): add error handling\"\n\n# 2. Push updates\ngit push origin feature\u002Fuser-auth\n```\n\n### 同步 Fork 与上游\n\n```bash\n# 1. Add upstream remote (once)\ngit remote add upstream https:\u002F\u002Fgithub.com\u002Foriginal\u002Frepo.git\n\n# 2. Fetch upstream\ngit fetch upstream\n\n# 3. Merge upstream\u002Fmain into your main\ngit checkout main\ngit merge upstream\u002Fmain\n\n# 4. Push to your fork\ngit push origin main\n```\n\n### 撤销错误操作\n\n```bash\n# Undo last commit (keep changes)\ngit reset --soft HEAD~1\n\n# Undo last commit (discard changes)\ngit reset --hard HEAD~1\n\n# Undo last commit pushed to remote\ngit revert HEAD\ngit push origin main\n\n# Undo specific file changes\ngit checkout HEAD -- path\u002Fto\u002Ffile\n\n# Fix last commit message\ngit commit --amend -m \"New message\"\n\n# Add forgotten file to last commit\ngit add forgotten-file\ngit commit --amend --no-edit\n```\n\n## Git 钩子\n\n### 预提交钩子\n\n```bash\n#!\u002Fbin\u002Fbash\n# .git\u002Fhooks\u002Fpre-commit\n\n# Run linting\nnpm run lint || exit 1\n\n# Run tests\nnpm test || exit 1\n\n# Check for secrets\nif git diff --cached | grep -E '(password|api_key|secret)'; then\n    echo \"Possible secret detected. Commit aborted.\"\n    exit 1\nfi\n```\n\n### 预推送钩子\n\n```bash\n#!\u002Fbin\u002Fbash\n# .git\u002Fhooks\u002Fpre-push\n\n# Run full test suite\nnpm run test:all || exit 1\n\n# Check for console.log statements\nif git diff origin\u002Fmain | grep -E 'console\\.log'; then\n    echo \"Remove console.log statements before pushing.\"\n    exit 1\nfi\n```\n\n## 反模式\n\n```\n# 错误：直接提交到主分支\ngit checkout main\ngit commit -m \"修复bug\"\n\n# 正确：使用功能分支和拉取请求\n\n# 错误：提交机密信息\ngit add .env  # 包含API密钥\n\n# 正确：添加到.gitignore，使用环境变量\n\n# 错误：巨大的拉取请求（超过1000行）\n# 正确：拆分为更小、更聚焦的拉取请求\n\n# 错误：\"更新\"类提交信息\ngit commit -m \"更新\"\ngit commit -m \"修复\"\n\n# 正确：描述性信息\ngit commit -m \"fix(auth): 解决登录后的重定向循环问题\"\n\n# 错误：重写公共历史\ngit push --force origin main\n\n# 正确：对公共分支使用回退\ngit revert HEAD\n\n# 错误：长期存在的功能分支（数周\u002F数月）\n# 正确：保持分支短期（数天），频繁变基\n\n# 错误：提交生成的文件\ngit add dist\u002F\ngit add node_modules\u002F\n\n# 正确：添加到.gitignore\n```\n\n## 快速参考\n\n| 任务 | 命令 |\n|------|---------|\n| 创建分支 | `git checkout -b feature\u002Fname` |\n| 切换分支 | `git checkout branch-name` |\n| 删除分支 | `git branch -d branch-name` |\n| 合并分支 | `git merge branch-name` |\n| 变基分支 | `git rebase main` |\n| 查看历史 | `git log --oneline --graph` |\n| 查看变更 | `git diff` |\n| 暂存变更 | `git add .` 或 `git add -p` |\n| 提交 | `git commit -m \"message\"` |\n| 推送 | `git push origin branch-name` |\n| 拉取 | `git pull origin branch-name` |\n| 暂存 | `git stash push -m \"message\"` |\n| 撤销上次提交 | `git reset --soft HEAD~1` |\n| 回滚提交 | `git revert HEAD` |\n",{"name":5,"origin":24,"description":7},"ECC","main","57e7aa6b6e03bce1a7d7862ba9c2ec312f7f19b5","src\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fdocs\u002Fzh-CN\u002Fskills\u002Fgit-workflow",0,"https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee","https:\u002F\u002Fwithcyril.me\u002F","Hi, I’m Julian Cyril D, a Computer Science and Business Systems student at PSNACET.\r\nI’m passionate about full-stack development, UI\u002FUX design, and building sma","2026-11-04 23:28:50",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add Cyrilthetecchieee\u002Fcyril-code- --skill git-workflow",{"tool":40,"command":41},"bunx","bunx skills add Cyrilthetecchieee\u002Fcyril-code- --skill git-workflow",{"tool":43,"command":44},"pnpm","pnpm dlx skills add Cyrilthetecchieee\u002Fcyril-code- --skill git-workflow","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fdocs\u002Fzh-CN\u002Fskills\u002Fgit-workflow\u002FSKILL.md",true,[],[49,58,65,73,80,87],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":54,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M7AQV6CYX8RMC78420V9WZ62","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7AQV2895N3S1MEX6K76G6G2","youtube-downloader","Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fvideo-downloader\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":69,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7AQTRNX62DNKVZ5GXEHRBKB","theme-factory","Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors\u002Ffonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftheme-factory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftheme-factory\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7AQTNNVHAAN9H6DA8T6ZVE0","template-skill","Replace with description of the skill and when Claude should use it.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftemplate-skill\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7AQTJ3MQ6AKX152MEX2MYCC","tailored-resume-generator","Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftailored-resume-generator\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":91,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7AQTD7D5MYET2YWG7HG9WM3","slack-gif-creator","Toolkit for creating animated GIFs optimized for Slack, with validators for size constraints and composable animation primitives. This skill applies when users request animated GIFs or emoji animations for Slack from descriptions like \"make me a GIF for Slack of X doing Y\".","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fslack-gif-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fslack-gif-creator\u002FSKILL.md",[],[]]