Skip to main content

commit_all_preserving_single_commit

Function commit_all_preserving_single_commit 

Source
pub async fn commit_all_preserving_single_commit(
    repo_path: PathBuf,
    base_branch: String,
    commit_message: String,
    message_strategy: SingleCommitMessageStrategy,
    no_verify: bool,
) -> Result<(), GitError>
Expand description

Re-exported commit/sync/diff APIs. Stages all changes and keeps a single commit for the provided message.

Creates a new commit when HEAD has no commits beyond base_branch. Otherwise, amends HEAD so the branch keeps one evolving session commit.

§Arguments

  • repo_path - Path to the git repository or worktree
  • base_branch - Branch used to detect whether a session commit already exists on HEAD
  • commit_message - Message that identifies the session commit
  • message_strategy - Whether amends replace or reuse the existing HEAD message
  • no_verify - When true, skips configured git hooks such as prek-managed pre-commit and commit-msg hooks (--no-verify)

§Returns

Ok(()) on success.

§Errors

Returns a GitError if staging, commit lookup, or committing changes fails.