!git.branch
The !git.branch Atmos YAML function returns the name of the current Git branch.
Usage
# Get the current branch name.
# If the branch name cannot be resolved (for example, in a detached HEAD state), it returns
# a default value if specified; otherwise, it returns an error.
!git.branch <default-value>
info
!git.branch returns an error when HEAD is detached (for example, during a CI checkout of a specific commit
or tag) unless a default value is provided.
Examples
vars:
git_branch: !git.branch
# With a fallback value for detached-HEAD CI checkouts.
git_branch_safe: !git.branch main