Skip to content

new_feature.git

new_feature.git

Wrap Git operations used by the managed feature lifecycle.

repo_root(cwd: Path) -> Path

Return the root directory of the Git repository containing cwd.

worktree_inventory(root: Path) -> dict[Path, str | None]

Return registered worktree paths and their checked-out local branches.

local_exclude_path(root: Path) -> Path

Resolve the local exclude file shared by the repository's worktrees.

ensure_repo_has_commits(root: Path) -> None

Raise when the repository has no commit that can seed a worktree.

create_worktree(root: Path, *, branch: str, worktree: Path, target_branch: str) -> None

Create a feature branch and worktree from the configured target branch.

pull_target(root: Path, *, target_branch: str) -> None

Fast-forward the clean, checked-out target branch from its upstream.

worktree_is_clean(worktree: Path, *, allow_untracked: bool = False) -> bool

Return whether a worktree has no staged, unstaged, or untracked changes.

untracked_paths(worktree: Path, *, excludes: list[str]) -> tuple[Path, ...]

List untracked files, including ignored files, except explicit ignore patterns.

initialized_submodules(worktree: Path) -> tuple[Path, ...]

List initialized submodule directories from the worktree index.

branch_paths(root: Path, branch: str) -> set[Path]

Return tracked paths at a branch tip, including submodule roots.

worktree_branch(worktree: Path) -> str | None

Return the checked-out branch, or None for a detached worktree.

branch_exists(root: Path, branch: str) -> bool

Return whether a local branch exists.

is_branch_merged(root: Path, *, branch: str, target_branch: str) -> bool

Return whether a branch is fully merged into the target branch.

branch_has_unique_patches(root: Path, *, branch: str, target_branch: str) -> bool

Return whether branch has a non-merge patch absent from the target history.

branch_has_unmerged_merge_commits(root: Path, *, branch: str, target_branch: str) -> bool

Return whether the branch range contains a merge commit Git cherry would ignore.

merge_is_clean(root: Path, *, branch: str, target_branch: str) -> bool

Return whether merging a feature branch into its target would avoid conflicts.

ensure_merge_is_clean(root: Path, *, branch: str, target_branch: str) -> None

Raise when merging a feature branch into its target would conflict.

checkout_target(root: Path, *, target_branch: str) -> None

Select the target before assuming ownership of its rollback state.

merge_feature_branch(root: Path, *, branch: str, target_branch: str, git_args: tuple[str, ...] = ()) -> None

Merge a feature branch into the expected target branch.

commit_merge(root: Path, *, name: str, git_args: tuple[str, ...] = ()) -> None

Finish a prepared merge with the appropriate message and editor behavior.

resolve_revision(root: Path, ref: str) -> str

Resolve a Git ref to its commit object ID.

merge_in_progress(root: Path) -> bool

Return whether the checkout has an active merge.

rollback_merge(root: Path, *, revision: str) -> None

Restore a checkout that was clean before a managed merge.

push_target(root: Path, *, target_branch: str) -> None

Push the updated target branch to its configured upstream.

remove_worktree_and_branch(root: Path, *, branch: str | None, worktree: Path, force: bool, force_branch: bool = False) -> None

Remove a worktree and its local branch when it has one.

git_environment() -> dict[str, str]

Keep transport settings but discard the caller's repository context.