Skip to main content

commit_worktree_paths

Function commit_worktree_paths 

Source
pub fn commit_worktree_paths(
    cwd: &Path,
    message: &str,
    paths: &[String],
) -> Result<bool>
Expand description

Commit the specified paths in the worktree directory.

Uses a temporary index seeded from HEAD, stages only the requested paths into that temporary index, creates a commit from that tree, and moves HEAD to the new commit. This records additions/modifications/deletions for the target paths without including or disturbing unrelated pre-staged changes in the real index. Paths must be relative to the repository root.