Combine a base config with environment-specific overrides.

Section: Anchors and aliases

Merge shared mappings

yaml
yaml
base: &base
  image: node:20
  pullPolicy: IfNotPresent

prod:
  <<: *base
  replicas: 3
Explanation

The merge key `<<` is widely used in tooling that supports YAML merge semantics.

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
Merge multiple anchors
Compose config from several reusable blocks.
OpenIn sheetyamlsame section
Expand anchors with yq
Materialize merged values for inspection.
OpenIn sheetbashsame section
Reuse CI step fragments
Share common setup across jobs.
OpenIn sheetyaml2 tag match
Reuse environment variables
Avoid copying the same environment block.
OpenIn sheetyaml1 tag match
Catch duplicate mapping keys
Lint for repeated keys that override silently in some parsers.
OpenIn sheetbash1 tag match