Section: Anchors and aliases

Anchor and alias

yaml
yaml
defaults: &defaults
  retries: 3
  timeout: 30

api:
  <<: *defaults
  url: https://api.example.com
Explanation

Anchors reduce repetition and keep repeated config blocks synchronized.

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
Merge multiple anchors
Compose config from several reusable blocks.
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