If I understand correctly, if I do
git diff master devel ./my_file
I get the diff between the two HEADs of the branches. However, if I have made changes in, say, master
and staged them, I thought I could get the diff between the unstaged file and the corresponding file in the other branch with
$ git diff --cached master devel ./my_file
but I get the following error:
usage: git diff [<options>] [<commit> [<commit>]] [--] [<path>...]
So what is the correct way to get the diff between staged changes in a file and the corresponding file in another branch?