How to use diff in git

5/27/2026 · 2 min read

The git diff command compares different states of your code to show exactly what lines have been added, modified, or deleted. It serves as a safety check before you stage or commit code.

Core Commands

Content that was removed or modified from the older version.Green text with a plus sign (+): Content that was added or represents the updated version.