The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Practical Git: Compare file changes with git diff

Practical Git: Compare file changes with git diff

5:20
It can be helpful to see the changes between two sets of code; `git diff` lets us do this by comparing two Git references and outputting the differences between them. In this lesson, we show how to use `git diff` along with the `--stat`, `--cached`, `HEAD`, `origin/master`, `file(s)/dir(s)` options.
Watch this lesson now
Avatar
egghead.io

It can be helpful to see the changes between two sets of code; git diff lets us do this by comparing two Git references and outputting the differences between them. In this lesson, we show how to use git diff along with the --stat, --cached, HEAD, origin/master, file(s)/dir(s) options.

Avatar
crawlregister

I think there is a mistake.

the 'git diff --cache' is used compare the last commit with staging area, rather than working directory and with staging area.

The transcript:
"But if we stage our file changes and rerun the cached command, we see the same diff output as before, but now it's between the working directory and the staging area, instead of the working directory and the last commit."

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?