Skip to content
yutils
Example

Input (left vs right text)

Left:
name: yutils
version: 0.1.0

Right:
name: yutils
version: 0.2.0

Output (Unified diff patch)

--- a
+++ b
@@ -1,2 +1,2 @@
 name: yutils
-version: 0.1.0
+version: 0.2.0

Note

Standard unified diff — applicable directly with `git apply` or `patch`. The `--- a` / `+++ b` headers are filename placeholders.

Usage / FAQ

When to use

  • Produce a git-apply-able patch between two pieces of text
  • Ship a quick change as a patch during code review
  • Review AI-suggested changes as a unified diff
  • Capture cross-environment config differences as a patch
  • Keep small DR fixes as a patch file

FAQ

Q.Can I apply the result with `git apply`?
A.Yes — it's standard unified diff. Replace the `--- a` / `+++ b` headers with the real file paths before running `git apply patch.diff`.
Q.Can I adjust the context lines (`-U`)?
A.Default is 3 lines (the unified default). The option is configurable — larger context reads more naturally, smaller context keeps the patch lean.
Q.What about binary files?
A.Text only. Binary files like images need a different tool.
Fun facts
  • The core algorithm behind Unix `diff` (LCS — Longest Common Subsequence) was developed in 1976 at Bell Labs by James Hunt and Doug McIlroy. McIlroy is also the inventor of the Unix pipe — it's no coincidence that `diff` came out of his lab.

    Hunt-McIlroy (1976)
  • In 1986, Eugene Myers published a faster O(ND) algorithm. Most modern diff tools (git diff by default, GNU diffutils) use this algorithm or a variant — 'Myers diff' is effectively the industry standard.

    jcoglan — Myers diff
  • The unified diff format (`+`, `-`, `@@` lines) was added to GNU diff by Wayne Davison in 1990, back when Larry Wall's `patch` (1985) only supported context diffs. It's now the standard for every patch file, git diff, and code review.

    Wikipedia — Unified diff