Skip to main content

Module git_state

Module git_state 

Source
Expand description

Git plumbing for the state branch topology: orphan branch creation, remote-tracking setup, and worktree attachment for an existing branch. Separate from git.rs so that module stays under the 300-line cap.

Functionsยง

branch_exists
True if branch exists locally.
create_orphan_branch
Create an orphan branch pointing at a single empty-tree commit. Uses mktree + commit-tree + update-ref so no working tree is disturbed; safe to call from any checkout.
create_tracking_branch
Create a local branch tracking remote/branch. Assumes the remote branch already exists as a remote-tracking ref.
has_remote_branch
True if remote/branch exists as a remote-tracking ref.
log_subjects
Return the subject line of every commit reachable from refname, oldest first in output iteration order (git log gives newest first; we reverse for stable order).
worktree_add_existing
Check out an existing branch into a new worktree.