Skip to main content

get_staged_diff

Function get_staged_diff 

Source
pub fn get_staged_diff() -> Result<String>
Expand description

Returns the diff of all staged changes.

This compares the staging area (index) with HEAD to show what will be committed.

§Errors

Returns an error if the diff cannot be generated.

§Examples

use rusty_commit::git;

let diff = git::get_staged_diff().unwrap();
println!("Staged changes:\n{}", diff);