xx
.md

git_sha

git_sha synchronously waits for dependencies, then resolves a revision in a local Git repository. It returns the full SHA-1 or SHA-256 commit ID as a string. If the repository cannot be opened or the revision cannot be resolved to a commit, it returns None.

This function only reads the local repository. It does not fetch refs or objects. Annotated tags resolve to their target commits.

Arguments

ArgumentRequiredDescription
revisionNoRevision or revision expression to resolve. Defaults to HEAD.
repositoryNoProject-relative Git repository directory. Defaults to ..
depsNoDependencies to complete before resolving the revision.

Example

load("@git@1", "git_sha")

current = git_sha()
release = git_sha("v1.0.0")