Skip to main content

get_current_head_oid

Function get_current_head_oid 

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

Get the current HEAD commit OID.

Returns the full SHA-1 hash of the current HEAD commit.

ยงErrors

Returns an error if:

  • Not in a git repository
  • HEAD cannot be resolved (e.g., unborn branch)
  • HEAD is not a commit (e.g., symbolic ref to tag)

Note: This function uses the current working directory to discover the repo.