Skip to content

Guard worktree removal or branch cleanup with an expected branch OID #3700

Description

@NathanaelRea

Motivation

An orchestrator may need Worktrunk to run pre/post-remove hooks and remove a worktree while retaining responsibility for branch identity. Between preflight and deletion, a branch name can be reused or advanced.

Request

Add an optional expected branch OID token to removal or a safe branch-scoped cleanup operation. Worktrunk should fail closed if the branch no longer resolves to that OID.

This would permit atomic lifecycle cleanup without allowing --force to delete a changed branch and without requiring broad Worktrunk state cleanup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions