Skip to content

cub unit diff

cub unit diff

Show differences between revisions

Synopsis

Show differences between revisions of a unit, or between two units.

Revision References: - Absolute: 123, 456 - Named: HeadRevisionNum, LastReleasedRevisionNum - Relative: -1, -2, -3 (N revisions back from HeadRevisionNum) - Tag: Tag:release-v1.0 - ChangeSet: ChangeSet:feature-deploy

Output Formats: - Default: Line-numbered format with color - Unified: Use -u for unified diff format (like git diff) - Color: Use -c to enable color in unified diff - Mutations: Use -o mutations for a structured diff, path by path, that matches list elements by merge key -- containers and environment variables by name -- rather than by position; -o json, yaml, jq= or yq= print that diff as data

Examples:

  # Basic (defaults: LastReleasedRevisionNum vs HeadRevisionNum)
  cub unit diff my-unit

  # Specific revisions
  cub unit diff my-unit --from=123 --to=456
  cub unit diff my-unit 123 456

  # Named revisions
  cub unit diff my-unit --from=LastReleasedRevisionNum

  # Relative to head
  cub unit diff my-unit --from=-1
  cub unit diff my-unit --from=-2 --to=-1

  # Unified diff format
  cub unit diff -u my-unit
  cub unit diff -uc my-unit --from=-1

  # Cross-unit diff
  cub unit diff my-unit --with-unit other-unit

  # What uploading a local file would change, against the head or --from
  cub unit diff my-unit --file my-unit.yaml

  # Show mutations instead of text diff
  cub unit diff my-unit -o mutations

  # The same, with the unchanged fields around each change
  cub unit diff my-unit -o mutations --diff-context
cub unit diff <unit-slug> [fromRev] [toRev] [flags]

Options

  -c, --color              colorize the unified diff output (default: true for numbered diff)
      --diff-context       with -o mutations or a data format, also show the unchanged paths around each change: every unchanged field and element of each map and list a change is in, up to the resource
      --file string        diff the unit, at its head or --from, against this local file (- for stdin)
      --from string        source revision (defaults to LastReleasedRevisionNum) (default "LastReleasedRevisionNum")
  -h, --help               help for diff
  -o, --output string      Output format: "mutations" replaces the text diff with a structured, path-by-path diff; json, yaml, jq=<expr> and yq=<expr> print that diff as data.
      --to string          target revision (defaults to HeadRevisionNum) (default "HeadRevisionNum")
  -u, --unified            output unified diff format
      --with-unit string   second unit for cross-unit diff (slug, space/slug, or UUID)

Options inherited from parent commands

      --component string   the Component of --variant, when that names the variant alone; --variant <component>/<variant> says the same in one flag
      --context string     The context to use for this command
      --debug              Debug output
      --space string       space to operate in, by slug or UUID. Omitted, a list or bulk operation spans the organization and a single entity is named as <space>/<slug>; "*" means the same as omitting it
      --variant string     variant to operate in, as <component>/<variant>, or as <variant> with --component: the space naming that Component whose Variant label is <variant>. The same scope as --space, named by what it is rather than by the space's slug; the two cannot be combined

SEE ALSO