git-worktree
Git Worktree
Overview
This skill allows you to quickly create a new git worktree for the current project. The worktree is created in the same parent directory as the current project's root, following the naming convention PROJECT-NAME-T-BRANCH-NAME.
Workflow
-
Verification:
- Verify the current directory is within a Git repository.
- Identify the absolute path of the project's root.
-
User Interaction: Proactively suggest values for the required parameters. Ask the user for:
- New branch name: The name of the branch to be created. Suggest a context-aware name (e.g.,
feat-improvementorfix-issue-123based on context. - Base branch: The branch to base the new branch on (Default: the current branch).
Crucially, if the user does not respond to a question or provides no alternative, proceed immediately using your suggested values instead of repeating the question. The goal is to minimize friction while allowing for customization.
- New branch name: The name of the branch to be created. Suggest a context-aware name (e.g.,
-
Path Calculation: Calculate the new worktree path at the same directory level as the project root. For example, if the project is in
/Users/user/my-project, the worktree will be created at/Users/user/my-project-T-NEW-BRANCH. -
Creation: Execute
scripts/create_worktree.shto:- Create the new worktree and branch.
- Perform initial project setup (e.g.,
flutter pub get,npm install).
-
Confirmation: Report the location of the new worktree and any initial setup status.
-
Management: Use
scripts/manage_worktrees.shto:- List all current project worktrees.
- Interactively select and remove a specific worktree.
Usage Example
User: "Create a worktree for this repo."
Gemini: "I'll create a new worktree for you. I'll use the branch name feat-wyatt_skills-260221 based on the current branch main. Is that okay, or would you like a different name?"
User: "That's fine."
Gemini: [Runs the script and confirms the path /Users/huwentao/_proj/wyatt_skills-T-feat-wyatt_skills-260221]
Another Example (Proactive/No Response):
User: "Create a worktree for feature-login."
Gemini: "I'll create a worktree for feature-login based on main. Starting the setup now..."
Gemini: [Runs the script and confirms the path /Users/huwentao/_proj/foo_proj-T-feature-login]
Manage Worktrees:
User: "Show my worktrees and help me delete one."
Gemini: "Here are your current worktrees. Which one would you like to remove?"
Gemini: [Lists worktrees and prompts for selection via scripts/manage_worktrees.sh]
Resources
scripts/
create_worktree.sh: A bash script that calculates the paths, runsgit worktree add, and performs initial project setup.- Arguments:
project_pathnew_branchbase_branch
- Arguments:
manage_worktrees.sh: A script to list and interactively remove worktrees.- Arguments:
project_path
- Arguments:
More from hu-wentao/wyatt_skills
clear-flutter-env
用于在 macOS 上清除 Flutter 环境变量 (FLUTTER_STORAGE_BASE_URL 和 PUB_HOSTED_URL)。适用于需要重置环境或解决 Flutter 代理问题的场景。
16publish-flutter-package
Automates the Flutter package release process via git tags and GitHub Actions. Handles multi-package workspaces, SemVer versioning suggestions based on git history, updating pubspec.yaml and CHANGELOG.md, and dry-run validation. Use when the user wants to "release", "publish", or "version" a Flutter package.
15update-wyatt-skills
用于更新 'wyatt_skills'仓库包含的技能集合, 当用户需要更新skills调用.
13merge-branch-into-current
Merge a specified branch into the current branch with a merge commit. Use this when the user wants to merge one branch into the current branch, or when Codex should auto-detect the source branch while currently on main. The skill checks whether the source branch and target branch have uncommitted work in any active git worktree and aborts if either branch is dirty.
2release-dart-package-action
Automates the Flutter package release process via git tags and GitHub Actions. Handles multi-package workspaces, SemVer versioning suggestions based on git history, updating pubspec.yaml and CHANGELOG.md, and dry-run validation. Use when the user wants to "release", "publish", or "version" a Flutter package.
2release-flutter-web-s3
Prepare, build, and publish a Flutter Web app to S3-compatible object storage. Use when Codex needs to bump or update pubspec.yaml version, create a Flutter Web release tag, configure a reusable S3 deployment script, build build/web, upload or promote web assets, or inspect a Flutter Web S3 release workflow.
1