git-worktree-feature-flow
Git Worktree Feature Flow
Use this skill when the user wants an isolated working directory for a feature (via git worktree), then to merge that branch back into a target branch and clean up the worktree.
Examples (user prompts)
- "Create a worktree for
feature/foooffmain." - "Spin up a worktree for my change, put it in
../wts/feature-foo." - "Merge my worktree branch back into
mainwith a squash merge, then clean up." - "Finish the worktree for
feature/foobut keep the branch around."
Quick flow
- Start: create a feature worktree
- Ask for
branchname (required). - Optional: ask for
baseref (default: current branch). - Run
scripts/worktree-start.sh.
-
Work: user edits/commits in the worktree directory.
-
Finish: merge + cleanup
- Ask for merge
strategy:merge(default),squash, orff-only. - Optional: ask for
intotarget branch (default: detected repo default branch, usuallymain). - Run
scripts/worktree-finish.sh.
Commands (scripts)
Start a worktree
$HOME/.codex/skills/git-worktree-feature-flow/scripts/worktree-start.sh --branch feature/my-change
Common options:
--base <ref>: base branch/ref to branch from (default: current branch)--path <dir>: where to place the worktree (default: sibling.worktrees/<repo>/<branch>)- If
--pathis relative, it’s interpreted relative to the repo root.
- If
--yes: do not prompt
Finish (merge back and clean up)
$HOME/.codex/skills/git-worktree-feature-flow/scripts/worktree-finish.sh --branch feature/my-change
Common options:
--into <branch>: target branch to merge into (default: detected default branch)--strategy merge|squash|ff-only: merge strategy (default:merge)--no-delete-branch: keep the feature branch after merging--keep-worktree: keep the worktree directory after merging--yes: do not prompt
Notes:
--keep-worktreeimplies you should also pass--no-delete-branch(you can’t delete a branch that’s still checked out in a worktree).- For
--strategy squash, the script creates a squash commit automatically and may force-delete the feature branch after committing (use--no-delete-branchto keep it).
Agent guidelines
- Prefer the scripts in
scripts/over manually typing longgit worktreecommands. - Confirm the user’s intended
branch,base, and mergestrategybefore making changes. - Be conservative:
- Refuse to proceed if the feature worktree has uncommitted changes unless the user explicitly wants to continue.
- Refuse to proceed if the target worktree (where the merge happens) is dirty.
- If cleaning up, don’t run the finish step from inside the feature worktree directory.
- After finishing, summarize:
- where the worktree lived,
- what merge strategy was used,
- whether the branch/worktree were deleted.
More from alessandrobologna/codex-skills
learn
Research a user-specified topic with current authoritative sources and package the findings as a reusable topic-kb skill (for example, kinesis-kb). Use when a user asks to learn about a topic, build a knowledge-base skill, or convert web research into reusable guidance.
4mermaid-github-safe-area
Ensure Mermaid diagrams in GitHub READMEs reserve bottom-right safe area using init-only config (no CSS, no spacer nodes) and optionally apply handrawn style on request.
4waylog-journal
Summarize `.waylog/history/*.md` into a sanitized per-session cache + a condensed, chronological `.waylog-journal/summary.md` journal.
3