compare two different files git code example
Example 1: git diff two commits one file
$ git diff HEAD^^ HEAD main.c
$ # show diff between HEAD(current commit) and HEAD^^(two commits back) for main.c
Example 2: git compare files with different names
git diff branch1:full/path/to/foo.txt branch2:full/path/to/foo-another.txt