Skip to content

How to write diff for YAML? #3323

Answered by RunDevelopment
simkimsia asked this question in Q&A
Discussion options

You must be logged in to vote

Diff Highlight uses the unified diff format. The rules of this format are as follows:

  1. Every line starting with a + is an addition.
  2. Every line starting with a - is a deletion.
  3. Every line starting with a (space) is unchanged.
  4. Lines starting with @@ contain range information.

Diff highlight supports the format in full, but you don't have to include range information. It will also work with diffs that don't have any range information. (Frankly, Diff highlight mostly ignores the range infos.)

how to write the yaml diff

You can do it by hand (see the rules above), but probably want to use a tool like git. It's pretty easy with the git diff <file> command. E.g.:

PS C:\Users\micha> git diff…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@simkimsia
Comment options

@simkimsia
Comment options

Answer selected by simkimsia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants