Skip to main content
ubx diff compiles the XCL stack and runs a preview against the current deployed state. With --from, it compares the stack at a git ref to the current deployed state — useful for reviewing what a PR would change.

Usage

ubx diff [path] [flags]

Flags

FlagDescription
--from <git-ref>Git tag, branch, or commit SHA to compare against
--jsonOutput raw Pulumi JSON preview

Examples

ubx diff                          # diff current stack vs deployed state
ubx diff --from main              # diff main branch vs deployed state
ubx diff --from v1.2.0            # diff at tag vs deployed state
ubx diff --from abc1234           # diff at commit SHA vs deployed state
ubx diff --json                   # JSON output

How --from works

  1. ubx lists all .xcl files in the stack directory
  2. For each file, runs git show <ref>:<path> to get the file at that ref
  3. Writes the files to a temporary directory
  4. Compiles the temporary directory and runs pulumi preview
  5. Cleans up the temporary directory
This shows what the plan would look like if you were currently on the given git ref, compared to what’s deployed.

Without --from

Without --from, ubx diff is equivalent to ubx plan — it compiles the current source and previews against the deployed state.

Use in GitOps

In a PR workflow:
ubx diff --from main   # "what does this PR add to what's on main?"
Or in CI:
- name: Diff vs main
  run: ubx diff --from ${{ github.base_ref }} --json > diff.json

Exit codes

CodeMeaning
0Diff succeeded
1Compile/typecheck/diff error