A simplified text format for describing file changes, inspired by the classic unified diff format.
📄 Read the full specification → SPEC.md
lite-diff is designed to be:
- Predictable — position matching by content, not line numbers
- Easy to read — minimal syntax, familiar to anyone who knows unified diff
- Easy to implement — clear rules, well-defined error codes
- AI-friendly — ideal for LLM-generated patches and code editing tools
--- hello.txt
+++ hello.txt
@@
-Hello, World
+Hello, lite-diff| Feature | Description |
|---|---|
| Content-based matching | Finds position by context, ignores line numbers |
@@ BOF / @@ EOF |
Insert at file beginning or end |
Boundary blocks ... |
Delete ranges between markers |
| Global options | --ignore-space-change, --apply-all-matches, etc. |
| File operations | Create, delete, rename, copy |
| Comments | Lines starting with # are ignored |
# Create a new file
--- /dev/null
+++ new-file.txt
@@
+First line
+Second line
# Delete a file
--- old-file.txt
+++ /dev/null
# Rename with modifications
rename from old.txt
rename to new.txt
--- old.txt
+++ new.txt
@@
-old content
+new contentlite-diff accepts standard unified diff headers (diff --git, ---/+++, @@) and extended Git headers. Most patches generated by git diff can be parsed by a lite-diff implementation.
However, lite-diff ignores numeric ranges in hunk headers — it finds positions by matching content, making patches more resilient to minor file changes.
See Interoperability Notes in the specification.
- JAI: Diff Editor (lite-diff) — VS Code extension
This specification is published under CC BY 4.0.
You are free to share and adapt it with attribution.
Found an issue or have a suggestion? Please open an issue.