Skip to main content

git_commit_files

Function git_commit_files 

Source
pub fn git_commit_files(
    repo_root: &Path,
    files: &[&str],
    message: &str,
) -> Result<(), GitError>
Expand description

Adds specified files to the Git index and records a commit with the given message.

Executes git add <files...> followed by git commit -m <message>.

§Arguments

  • repo_root - Path to the repository root directory.
  • files - List of file paths relative to repo_root to stage and commit.
  • message - Commit message text.

§Example

use std::path::Path;
use git_claw::infra::git::git_commit_files;

git_commit_files(Path::new("."), &["Cargo.toml"], "chore: release 0.2.0")?;