Compare
Deeply compare two yaml documents
Last updated
Was this helpful?
Deeply compare two yaml documents
Last updated
Was this helpful?
Compares the matching yaml nodes at path expression in the two yaml documents. See for more details. Difference calculated line by line, and is printed out line by line where the first character of each line is either:
a space, indicating no change at this line
-
a minus ,indicating the line is not present in the second document (it's removed)
+
a plus, indicating that the line is not present in the first document (it's added)
If there are differences then yq
will print out the differences and exit with code 1. If there are no differences, then nothing will be printed and the exit code will be 0.
Given data1.yaml
and data2.yaml
Basic will compare the yaml documents 'as-is'
yields
yields
yields
Most of the time, it will make sense to the documents before comparing:
Use to compare subsets of yaml documents