Compose config from several reusable blocks.

Section: Anchors and aliases

Merge multiple anchors

yaml
yaml
common: &common
  logging: json
security: &security
  readOnlyRootFilesystem: true

service:
  <<: [*common, *security]
  port: 8080
Explanation

Useful for DRY configuration where shared defaults come from multiple sources.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Anchors and aliases
Anchor and alias
Define once and reuse many times.
OpenIn sheetyamlsame section
Expand anchors with yq
Materialize merged values for inspection.
OpenIn sheetbashsame section
Merge shared mappings
Combine a base config with environment-specific overrides.
OpenIn sheetyamlsame section
Reuse environment variables
Avoid copying the same environment block.
OpenIn sheetyaml2 tag match
Reuse CI step fragments
Share common setup across jobs.
OpenIn sheetyaml1 tag match
Catch duplicate mapping keys
Lint for repeated keys that override silently in some parsers.
OpenIn sheetbash1 tag match