Josh C
Josh C

Reputation: 8421

View uncommitted changes to a specific file with git

How do I see uncommitted changes that have been made to a specific file with git? I have tried

git diff

but I get all of the changes of the entire repo. When I tried

git diff <filename> 

I got

fatal: ambiguous argument 'style1.css': unknown revision or path not in the working tree. Use '--' to separate paths from revisions

so then I tried

git diff -- <filename>

with the same result.

Upvotes: 4

Views: 1067

Answers (1)

Josh C
Josh C

Reputation: 8421

Turns out the file was in a directory that I didn't expect and the error message was correct. This works as expected.

git diff </path/and/file/name>

Upvotes: 5

Related Questions