Skip to main content

get_current_branch

Function get_current_branch 

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

Returns the current branch name.

§Errors

Returns an error if the repository has no HEAD or if the branch name cannot be determined.

§Examples

use rusty_commit::git;

let branch = git::get_current_branch().unwrap();
println!("Current branch: {}", branch);