# !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](/functions/yaml/scope) for field restrictions, import timing, and native tags versus quoted strings.

## Usage

```yaml
  # 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

```yaml
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
```

## Related Functions

- [`!git.ref`](/functions/yaml/git.ref) — alias of `!git.sha`, intended for source-pinning use cases
- [`!git.branch`](/functions/yaml/git.branch) — the current branch name
- [`!git.repository`](/functions/yaml/git.repository) — the full `<owner>/<name>` slug
