Last Updated: February 25, 2016
·
994
· nicolaslazartekaqui

Git - Show diff on file in staging area

Assuming you have changes in file.txt

$ git diff file.txt
# return diff

when you add file in staging area

$ git add file.txt

you cant show diff using git diff

$ git diff file.txt
# return nothing

you can show diff using arg --cached or --staged

$ git diff --cached file.txt
# return diff

More about git-diff: https://www.kernel.org/pub/software/scm/git/docs/git-diff.html

1 Response
Add your response

cool! I needed this many times but never bothered to look for it! thanks!

over 1 year ago ·