Viewing Changes with diff
git diff shows unstaged changes. git diff --staged shows what will be committed.
Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
echo two >> a.txt
git diff | grep '^[+-]' | grep -v '^+++\|^---'
git add a.txt
git diff --staged --stat | tail -1Result
+two 1 file changed, 1 insertion(+)
Exercise
Staged changes.
git diff Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.