git diff between two branches

# Show all changes between two branches
git diff main..feature/login

# Show only the changed file names (no diff content)
git diff --name-only main..feature/login

You want to review what changed on a feature branch before merging it into main.

Diff a specific file between two branches

git diff main..feature/login -- src/auth.ts

Two-dot (..) vs three-dot (...) diff

main..feature shows changes since the branches diverged. main...feature shows only what changed on feature since the merge base.

git diff main..feature     # all diff between the two branch tips
git diff main...feature    # only what feature changed since branching off main

Show a summary of changed lines per file

git diff --stat main..feature/login