Explain git diff code

Paste what git diff printed and Vibe explains each change: what the @@ line counts, which lines a - or + marks and what a rename or index line is telling you.

changes.diff

Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.

Vibe25 lines selected

Press Explain it for the sample, or paste your own code first.

What this git diff sample shows

file headers
Each file starts with diff --git a/... b/..., where a/ is the old version and b/ the new one. The index 9853b5d..97c2803 100644 line gives short hashes of the file's contents before and after, and its mode: 100644 is an ordinary file that isn't executable (100755 would be). Then --- a/cart.js and +++ b/cart.js say which side the - and + lines come from.
hunks
@@ -1,11 +1,13 @@ reads: this part starts at line 1 and covers 11 lines in the old file, and starts at line 1 and covers 13 lines in the new one. Counting the sample agrees: 11 lines are context or -, and 13 are context or +. With -U1, git kept 1 line of context instead of 3 and split the change into two hunks. The second header, @@ -5,5 +6,6 @@ function total(items) {, ends with the nearest line above the change that looks like a heading, here the function it sits in.
added and removed lines
A - line was removed, a + line was added, and a line that starts with a space is unchanged context. An edited line shows up as both: - return sum; and then + return Math.round(sum * (1 + TAX));. Before the change, receipt() for 2 items at 1250 cents printed Total: $25.00; after it, Total: $27.00.
renames
similarity index 100% with rename from and rename to means utils.js moved to lib/money.js with nothing inside it changed. git diff --staged --name-status printed R100 utils.js lib/money.js. With --no-renames, the same move showed as D utils.js and A lib/money.js: one file deleted and another added.

Good to know

  • Made with git 2.55.0 in a test repo with a fixed name and date. In git's output, an unchanged blank line is a single space, and it's kept that way here.
  • git diff --staged --stat summed it up as cart.js | 6 ++++--, utils.js => lib/money.js | 0 and 2 files changed, 4 insertions(+), 2 deletions(-).
  • --word-diff marks the change inside a line instead of whole lines: return [-sum;-]{+Math.round(sum * (1 + TAX));+}.
  • One added line can change more than it looks. Before if (item.qty <= 0) continue;, an item priced 999 with qty: -1 took 999 off the total: total() returned 1501 for it and 2 items at 1250. After the change, the same cart returned 2700: the item is skipped and tax is added.

Watch out: Plain git diff only shows changes you haven't staged yet. Once everything was added with git add -A, git diff printed nothing at all, and only git diff --staged showed the change. Before staging, plain git diff listed utils.js as deleted and left lib/money.js out completely, because git doesn't track a new file until it's added.

Explain git diff code beside your editor

Unvibe is a free app for Mac and Windows. In the app there is no pasting: select code in any app and press Control+U (Ctrl+Alt+U on Windows).

Install on Mac

curl -fsSL https://unvibe.site/install.sh | bash

Paste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.

Opening the .dmg the first time
  1. Open the .dmg and drag Unvibe to Applications.
  2. Open it once; macOS says it can't verify it. Click Done.
    macOS dialog: Unvibe Not Opened, with Done and Move to Trash
    Real screen, macOS 15
  3. System Settings › Privacy & Security › Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.
    macOS Privacy & Security, Security section: Unvibe was blocked to protect your Mac, with the Open Anyway button
    Real screen, macOS 15

The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open