Skip to main content

create_worktree

Function create_worktree 

Source
pub fn create_worktree(
    store: &Store,
    subprocess_options: GitSubprocessOptions,
    destination: &Path,
) -> Result<(), GitCreateWorktreeError>
Expand description

Creates a Git worktree at destination to back a jj workspace.

Nothing is checked out: the worktree is created with HEAD unborn, so jj remains responsible for the working-copy contents. destination may already hold a populated jj workspace, as it does when colocation is enabled after the fact.

For a new workspace, the subsequent HEAD export (see reset_head()) points HEAD at the parent of the new working-copy commit. Git is only responsible for the .git gitlink and the worktree bookkeeping under .git/worktrees/.