I\'m using
git diff mycommit
for comparing my working tree with mycommit
, but it seems to ignore files not present in the current
manojlds wrote in his answer
Basically, diff does not take into account untracked files. That is why you see that the file is deleted, because the diff is same as git diff B A
This is true and worth upvoting, but it didn't satisfy me, as it says neither "how can I compare it" not gave it the deeper reason behind. I still thought it was a bug, so I asked at the git forum and got a long answer by somebody who surely knows. The important parts for me are:
The definition of paths in the working tree in these sentences is not "all files on the filesystem", or "all files on the filesystem, filtered with the ignore mechanism". It is "all files on the filesystem that are in the index" ...
and
...that will give a clean semantics to "git diff HEAD": what change would I be recording if I said "git commit -a" at this point?