Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View uncommitted changes to a specific file with git

Tags:

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.

like image 280
Josh C Avatar asked Sep 01 '25 05:09

Josh C


1 Answers

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>

like image 107
Josh C Avatar answered Sep 02 '25 19:09

Josh C