Вы пытаетесь сравнить ваше рабочее дерево с конкретным именем ветви, поэтому вы хотите следующее:
git diff master -- foo
Из этой формы git-diff (см. Страницу руководства git-diff)
git diff [--options] <commit> [--] [<path>...]
This form is to view the changes you have in your working tree
relative to the named <commit>. You can use HEAD to compare it with
the latest commit, or a branch name to compare with the tip of a
different branch.
К вашему сведению, есть также опция --cached
(он же --staged
) для просмотра различий в том, что вы поставили, а не все в вашем рабочем дереве:
git diff [--options] --cached [<commit>] [--] [<path>...]
This form is to view the changes you staged for the next commit
relative to the named <commit>.
...
--staged is a synonym of --cached.