# Picking a Git Diff View Before Reviewing a Patch

When a change touches several files, I start with a narrow diff. First I check whether the change is staged, unstaged, or present in both places. Then I open one file and review the reason for the change before reading every line.

## Compare the right states

`git diff -- path/to/file` compares the working tree with the index for that file. `git diff --cached -- path/to/file` compares the index with HEAD. If the two views show different edits, I review the staged one as the proposed commit and keep the rest for a later pass.

I sometimes use `git diff --stat` first for an overview. It is enough to catch an unexpected file, while the scoped diff tells me what actually changed. An untracked file is better spotted with git status.

I maintain vsux, an open-source macOS terminal workspace. Its Git panel and project terminal are two ways I use to keep the review scoped to the repository I am working on. [Browse the vsux source on GitHub.](https://github.com/shadowDragons/vsux)

Drafting and editing used AI assistance.
