codecontext diff

Compare documentation changes before applying

Preview exactly what will change in your documentation before applying updates. See side-by-side comparisons, understand AI decisions, and make informed choices about which changes to accept.

Quick Usage

codecontext diff src/

Shows proposed changes without modifying files

Example Output

$ codecontext diff src/auth.ts
src/auth.ts
3 changes proposed
@@ -12,0 +12,8 @@
/**
* Authenticates user credentials and returns a JWT token
* @param email - User email address
* @param password - User password
* @returns Promise<AuthToken> - JWT token with user info
* @throws AuthError if credentials are invalid
*/
async function authenticate(email, password) {

Diff Modes

Unified Diff

Traditional diff format showing changes inline

codecontext diff --unified

Side-by-Side

Visual comparison with before/after columns

codecontext diff --side-by-side

Summary Only

High-level overview of changes per file

codecontext diff --summary

Interactive Review

Step through changes one by one

codecontext diff --interactive

Interactive Review

Change 1 of 3 in src/auth.ts
+ Added function documentation
8 lines added

Command Options

codecontext diff --output=diff.patch

Save diff to file for later review

codecontext diff --type=docstring

Show only specific types of changes

codecontext diff --color=always

Force color output for piping

codecontext diff --context=10

Show more context lines around changes

Change Statistics

Example Summary Output

12 files will be modified
+ 156 lines added
- 23 lines removed
~ 45 lines modified
Documentation coverage: 67% → 89%
Functions documented: 45/67 → 67/67

Pro Tips

  • Always diff before running update on important files
  • Use --output to share changes with team
  • Interactive mode is great for selective updates
  • Pipe to less for easier navigation

Related Commands