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
Written by Nícolas Lazarte Kaqui
Related protips
1 Response
cool! I needed this many times but never bothered to look for it! thanks!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#