Skip to main content

get_commits_between

Function get_commits_between 

Source
pub fn get_commits_between(base: &str, head: &str) -> Result<Vec<String>>
Expand description

Returns a list of commit hashes and messages between two branches.

The output format is "<hash> - <message>" for each commit, with the hash truncated to 7 characters.

§Arguments

  • base - The base branch/commit (exclusive)
  • head - The head branch/commit (inclusive)

§Errors

Returns an error if the branches cannot be parsed or the repository cannot be accessed.

§Examples

use rusty_commit::git;

let commits = git::get_commits_between("main", "feature-branch").unwrap();
for commit in commits {
    println!("{}", commit);
}