Sign In

git diff

Show unstaged changes (including intent-to-add new files) by diffing your working tree against the index.

This command is useful for reviewing what has changed in your working directory before you stage or commit anything. It compares the current contents of your files (the working tree) with what is currently recorded in the index, so you can clearly see unstaged edits and newly added-but-empty entries from --intent-to-add.

By default, this command shows line-by-line differences for all tracked files that have unstaged changes, highlighting added, removed, and modified lines. It also displays content for files marked with --intent-to-add, even though they are not fully staged yet, helping you verify new files before actually adding them.

Closely related usages include git diff --cached to review staged changes, git diff HEAD to see all changes since the last commit (staged and unstaged), and git status to see a summary of which files are modified, staged, or untracked.

Manual page
git diff
Related commands

Sign in to Git Examples