injllq
Last Updated: February 25, 2016
·
724
· nicolaslazartekaqui
Img 3566

Git - Show diff on file in staging area

git

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

Say Thanks
Respond

1 Response
Add your response

7438
1263ff3465dd790d0b2052eb397fba9f

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

over 1 year ago ·
Filed Under