Search code examples
git-diffsubdirectory

Why does git diff fail to work on changes in subdirectories?


Why does git diff fail to work on changes in subdirectories?

When I do a git diff *c and the C files are in subdirectories, git outputs an error message.

 $ git diff *c                                                      
 fatal: ambiguous argument '*c': unknown revision or path not in the
 working tree. Use '--' to separate paths from revisions, like
 this: 'git <command> [<revision>...] -- [<file>...]'

What option is required to make git diff to list changes in the subdirectories as well?


Solution

  • Looks like the command is missing quotes and they are not optional:

       $ git diff -- '*.c'