Skip to content

Worktree branch policy: never on development or main - #148

Merged
lmoresi merged 1 commit into
developmentfrom
docs/worktree-policy
Apr 28, 2026
Merged

lmoresi merged 1 commit into
developmentfrom
docs/worktree-policy

Conversation

@lmoresi

@lmoresi lmoresi commented Apr 27, 2026

Copy link
Copy Markdown
Member

Summary

Documents the worktree branch policy that's been operating implicitly:

  • main is the release branch (tagged quarterly, read-only history)
  • development is the integration trunk where active work converges
  • The default repo checkout sits on development — for reading current state and pulling
  • All work happens on a side branch in a worktree (feature/, bugfix/, docs/), then merges to development via PR

What's tightened

  1. ./uw worktree create x development (or main) is now refused with a clear message pointing the user at either the main repo or a side-branch prefix.

  2. ./uw worktree list flags any worktree currently on development or main with a yellow ⚠ advisory and a "branch off" suggestion. Surfaces pre-existing violations.

  3. Documentation added in CLAUDE.md (Worktree branch policy subsection under Git Worktrees) and docs/developer/guides/branching-strategy.md (detailed rationale section).

Test plan

  • bash -n uw passes
  • ./uw worktree create test-rejection development is refused with the expected message
  • ./uw worktree list shows the ⚠ advisory next to any pre-existing worktree on development
  • CI smoke

Note: existing violation

This branch surfaces (but does NOT auto-fix) one existing violation:
region-ds-cell-labels worktree is currently on [development]. The
advisory in ./uw worktree list flags it; the owner of that work
should branch off to e.g. feature/region-ds-cell-labels before
their next commit.

🤖 Generated with Claude Code

Document the rule that's been operating implicitly in this repo:

  * `main` is the release branch (tagged quarterly, read-only history).
  * `development` is the integration trunk where active work converges.
  * The default repo checkout (~/+Underworld/underworld3-pixi) sits on
    `development` — that's where you read current state and pull.
  * All work — even work that will merge to `development` — happens
    on a side branch (feature/, bugfix/, docs/) in a worktree.

`./uw worktree create` already enforces this for new worktrees (it
creates `<prefix>/<name>` and resets to origin/development).  Two
small tightenings here:

1. `./uw worktree create x development` (or `main`) is now refused
   with a clear message pointing the user at either the main repo
   or a regular side-branch prefix.

2. `./uw worktree list` flags any worktree currently on `development`
   or `main` with a yellow ⚠ advisory and a "branch off" suggestion.
   Useful for surfacing pre-existing violations (e.g. worktrees
   created with `git worktree add` directly).

Documentation added in two places:
  - CLAUDE.md "Worktree branch policy" subsection under Git Worktrees
  - docs/developer/guides/branching-strategy.md detailed rationale

The default checkout-on-development rule is restated in both.

Underworld development team with AI support from Claude Code (https://claude.com/claude-code)
Copilot AI review requested due to automatic review settings April 27, 2026 23:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Documents and enforces the repository’s existing Git worktree branching policy: the main checkout stays on development for integrating/pulling, while all worktree-based work happens on side branches and never directly on development or main.

Changes:

  • Refuse ./uw worktree create <name> development|main with a clear guidance message to use side-branch prefixes.
  • Add a warning advisory in ./uw worktree list when a worktree is currently on development or main.
  • Document the policy and rationale in contributor docs (CLAUDE.md + branching strategy guide).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
uw Enforces the policy at worktree creation time and surfaces existing violations in worktree listing output.
docs/developer/guides/branching-strategy.md Adds a “worktrees are always on a side branch” policy section with rationale and do/don’t guidance.
CLAUDE.md Adds a concise worktree branch policy subsection for AI/human workflow alignment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lmoresi

lmoresi commented Apr 28, 2026

Copy link
Copy Markdown
Member Author

Trivial change to policy docs ... waving this through.

@lmoresi
lmoresi merged commit b2001c4 into development Apr 28, 2026
5 checks passed
@lmoresi
lmoresi deleted the docs/worktree-policy branch June 13, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants