Show staged differences in git

You can use git diff to also show staged (cached) changes and compare them to the last committed change as follows:

$ git diff --staged example.php

This will show you the differences between the last committed change and the changes you have made, but not yet committed (i.e. are staged). Note you can use (–cached which means the same thing).