Skip to main content

!git.sha

The !git.sha Atmos YAML function returns the full commit SHA of the current Git HEAD.

Availability and evaluation​

Supported locations:

  • CLI configuration (atmos.yaml, atmos.d, and profiles): during configuration loading.
  • Resolved stack values: after inheritance, merging, and component template processing.
  • Scaffold manifests: during manifest loading.

Automatic evaluation requires native YAML tags from edition 2026-10-20, including unpinned projects. Quoted function strings remain literal; earlier editions retain legacy string-form behavior.

See YAML function scope for field restrictions, import timing, and native tags versus quoted strings.

Usage​

# Get the current HEAD commit SHA.
# If the SHA cannot be resolved, it returns a default value if specified; otherwise, it returns an error.
!git.sha <default-value>

Examples​

vars:
build_sha: !git.sha

# With a fallback value when the SHA cannot be resolved (e.g. not a Git repository).
build_sha_safe: !git.sha unknown