Git Diff Viewer

Paste and visualize git diff output — highlighted additions, deletions, and context with file and line tracking.

About Git Diff

Git diff shows the differences between two states of a repository. The output uses unified diff format: lines starting with + are additions (shown in green), lines with - are deletions (shown in red), and unchanged context lines (shown in gray) provide surrounding context. The @@ markers show the line numbers in the original and modified files.

Common git diff commands: git diff (unstaged vs staged), git diff --staged (staged vs last commit), git diff HEAD (all changes vs last commit), git diff main..feature (between two branches), git show COMMIT (what a commit changed). Understanding diff output is essential for code reviews, debugging, and understanding what changed between versions.

FAQ

What do the @@ symbols mean in diff output?
The @@ line is the "hunk header" — it shows the line numbers: @@ -a,b +c,d @@ means the hunk starts at line a in the original file (b lines), and line c in the new file (d lines). The optional text after @@ shows the function or class context. This helps you find the change in the original file without counting lines.
How do I create a diff file to share with someone?
Save diff output to a file: git diff > changes.patch. Apply it on another machine: git apply changes.patch. For a complete patch including commit metadata: git format-patch HEAD~1. Apply a format-patch: git am patch-file. These patch files can be emailed or shared as text files.