git - diff of current changes before committing

git diff by default shows difference between your working directory and the index (staging area for the next commit).

If you have already added (staged) the changes to the staging area, git diff --staged does the job. Staging area is the data from which the next commit will be formed by git commit.

P. S. Good reading (IMO) for Git beginners:

  • https://git-scm.com/book/en/v2 (most chapters; it explains the model behind Git and answers most of typical questions)
  • and then immediately http://gitready.com/ (usage tips).

What i use for such cases is:

git diff HEAD *

This will show the changes since last commit. Although somehow it works quicker with

git diff .

or

git diff

To see the changes on previously git added files, use the staged flag:

git diff --staged

Tags:

Git

Ssh

Diff

Meld