TOOL » GIT

Diff

Usage

shell
git diff OPTIONS COMMIT -- PATH
OptionDescription
--cached --stagedShow changes in the staging area.
--word-diffChange to show word diff mode.
--statGenerate a diffstat.
--no-indexCompare two files outside a git repository.
CommitDescription
COMM1 COMM2Difference between two arbitrary commits.
HEAD~NDifference between the previous commit and the working tree.
HEAD~N.. HEAD~N..HEADDifference between a recent commit and the latest commit.
HEAD~N..HEAD~MDifference between two recent commits.

Example

Compare uncommited changes in file foo with another branch.

shell
git diff master:foo foo