Posted By: Anonymous
In Git, how could I compare the same file between two different commits (not contiguous) on the same branch (master for example)?
git diff [--options] <commit> <commit> [--] [<path>...]
For instance, to see the difference for a file “main.c” between now and two commits back, here are three equivalent commands:
$ git diff HEAD^^ HEAD main.c $ git diff HEAD^^..HEAD -- main.c $ git diff HEAD~2 HEAD -- main.c