帮助你创建、切换并检查代码分支,确保实现前遵循正确分支策略。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "git-branch" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/devsquad-copilot/main/.github/plugins/devsquad/skills/git-branch/SKILL.md 2. 保存为 ~/.claude/skills/git-branch/SKILL.md 3. 装好后重载技能,告诉我可以用了
请基于 main 创建一个名为 feature/login-page 的新分支,并切换到该分支。
返回创建并切换分支所需的 Git 命令或操作步骤。
请告诉我如何查看当前所在分支,并列出本地所有分支。
返回查看当前分支及本地分支列表的命令。
我要修复一个线上紧急 bug,请先帮我确认应该从哪个分支切出新分支,并说明原因。
给出建议的起始分支、分支命名方式,以及简要策略说明。
cat .memory/git-config.md 2>/dev/null
If Branching Strategy is filled in, use the configured strategy. The detect-branching-strategy.sh hook automatically seeds on sessionStart.
If the config has Confidence: medium, confirm with the dev before using (see Detect Branching Strategy section).
Before starting implementation:
git branch --show-current
git status
git fetch origin
If on main/master/develop, check synchronization:
git rev-list HEAD..origin/<branch> --count
| Situation | Action |
|---|---|
| Branch behind (commits behind remote) | Alert and suggest pull |
| Branch with uncommitted local changes | Alert about pending changes |
| Branch up to date and clean | Proceed normally |
If the main branch is behind:
Your branch [main] is [N] commits behind the remote.
I recommend updating before creating a new branch:
[P] Pull and continue
[I] Ignore and continue anyway (not recommended)
[A] Abort implementation
| Situation | Action |
|---|---|
| Already on a feature branch (not main/master/develop) | Use current branch |
| On main/master/develop without changes with work item | Create branch automatically (see below) |
| On main/master/develop without changes without work item | Ask if they want to create a branch |
| On main/master/develop with changes | Alert and ask how to proceed |
When the source of work is a GitHub issue or Azure DevOps work item, create the branch automatically.
Naming convention:
feature/<id>-<short-description>
Rules for <short-description>:
Examples:
| Work Item | Branch |
|---|---|
| #42 "Implement user authentication" | feature/42-user-authentication |
| #108 "Add rate limiting to API endpoints" | feature/108-rate-limiting-api |
| WI 5678 "Create financial reports endpoint" | feature/5678-financial-reports-endpoint |
Action: Create branch and inform the user:
Branch created: feature/<id>-<short-description>
[C] Continue with this branch
[R] Rename branch: _
The user can rename, but the flow does not block waiting for confirmation to create.
When the source is tasks.md (without issue/work item), ask the user:
You are on the main branch. Do you want me to create a branch for this implementation?
Suggestion: feature/<short-description>
[S] Yes, create suggested branch
[N] No, continue on current branch
[C] Create with another name: _
If the user is already on a feature branch, use the current branch without additional questions.
When .memory/git-config.md does not exist or does not have Branching Strategy, detect automatically:
# 1. Default branch
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
# 2. Does develop branch exist?
HAS_DEVELOP=$(git ls-remote --heads origin develop 2>/dev/null | grep -q develop && echo "yes" || echo "no")
# 3. Do release/* or hotfix/* branches exist? (GitFlow pattern)
HAS_GITFLOW_BRANCHES=$(git branch -r 2>/dev/null | grep -qE '(release|hotfix)/' && echo "yes" || echo "no")
develop | release/* or hotfix/* | Strategy | Confidence | Action |
|---|---|---|---|---|
| Yes | Yes | GitFlow | High | Save and inform |
| Yes | No | GitFlow | Medium | Ask to confirm |
| No | No | Trunk-Based | High | Save and inform |
High confidence — save automatically and inform:
…
为软件架构图提供设计与审查建议,提升文档中的图示清晰度与规范性
用于统一项目 Markdown 文档的格式、结构与写作风格规范。
基于代码差异生成规范化 Git 提交信息,并支持按逻辑分组提交
用于初始化项目或校验并生成 SDD 文档模板,确保规范齐全且为最新版本。
用于初始化项目时检查并创建社区治理所需的标准仓库文件。
系统化排查测试失败、构建中断与异常运行问题,帮助快速恢复开发进度
在实现完成后协助提交代码、推送分支并发起拉取请求与自动审查。
帮助你同步当前分支与上游分支,完成拉取、变基、推送或发布操作
帮助你使用 Git worktree 创建相互隔离的并行工作区。
根据当前会话中的代码改动,快速创建可提交的拉取请求。
对本地或PR分支执行结构化代码审查,帮助提交或发布前发现问题。
帮助用户用 GitHub CLI 管理议题、PR、CI 日志、评论、发布与接口查询。