feature-branch
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate a feature branch in a new git worktree, as a sibling directory of the current project.
在当前项目的同级目录中,于新的Git Worktree内创建功能分支。
Steps
步骤
-
Determine the issue — the argument can be:
- A GitHub issue number or URL → fetch with
gh issue view - A description → search with to find the matching issue
gh issue list --search "<description>" - Nothing → ask the user what they're working on, then search
- A GitHub issue number or URL → fetch with
-
Generate a branch name:
- Format: (e.g.
<issue-number>-<kebab-case-summary>)42-add-user-export - Keep it under 50 characters where possible
- Format:
-
Ensureis up to date:
maingit fetch origin main
-
Create a worktree as a sibling of the current project directory:
git worktree add ../<branch-name> -b <branch-name> origin/main- This creates alongside the current project directory
../<branch-name>/
-
Confirm to the user:
- Show the branch name
- Show the worktree path
- Summarize what the issue is about
- Remind them to to start working
cd ../<branch-name>
-
确定Issue —— 参数可以是:
- GitHub Issue编号或URL → 使用获取详情
gh issue view - 描述内容 → 使用搜索匹配的Issue
gh issue list --search "<description>" - 无参数 → 询问用户正在处理的内容,再进行搜索
- GitHub Issue编号或URL → 使用
-
生成分支名称:
- 格式:(例如:
<issue-number>-<kebab-case-summary>)42-add-user-export - 尽可能保持长度在50个字符以内
- 格式:
-
确保分支是最新的:
maingit fetch origin main
-
在当前项目目录的同级位置创建Worktree:
git worktree add ../<branch-name> -b <branch-name> origin/main- 此命令会在当前项目目录旁创建目录
../<branch-name>/
-
向用户确认信息:
- 显示分支名称
- 显示Worktree路径
- 概述Issue的内容
- 提醒用户执行开始工作
cd ../<branch-name>