Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

Is there a way I can see the changes that were made to a file after I have done a git add file?

That is when I do:

git add file

git diff file

no difference is shown. I guess there's a way to see the differences since the last commit but I don't know what that is.

1 Answer

0 votes
by (50.2k points)

You can use --cached option which shows you the staged changes in cache/index

 git diff --cached

--staged is the synonym for --cached

In more recent versions of git, you can also use the --staged flag 

$ git diff --staged

This command will show you what is staged.

Related questions

Browse Categories

...