Skip to main content

git_diff

Function git_diff 

Source
pub async fn git_diff(
    repo: &Path,
    path: Option<&str>,
    staged: bool,
) -> Result<String, GitError>
Expand description

Return a unified diff for the repository or a specific file.

  • staged = true produces git diff --cached (index vs HEAD).
  • staged = false produces git diff (working tree vs index).
  • path restricts the diff to a single file.