Git diff between two different files

In HEAD (final commit), I have a file called foo . In my working tree, I renamed it to bar , and also edited it.

I want git diff foo in HEAD and bar in the current working tree.

+42
git diff
May 22 '13 at 3:43
source share
3 answers

Check the --find-renames on git-diff at https://www.kernel.org/pub/software/scm/git/docs/git-diff.html

Or specify the paths explicitly:

git diff HEAD:full/path/to/foo full/path/to/bar

(The credit goes to twaggs from Git: how to split two different files in different branches? )

+65
May 22 '13 at 3:52
source share

If you use the git tortoise, you can right-click the file and git a diff: Right-click on the first file and select "Diff later" in the tortoise submenu. Then in the second file you can also right-click on it, go to submenu tortoisegit and then select "Diff with yourfilenamehere.txt"

+1
Jan 11 '16 at 2:54 on
source share

Using PhpStorm, I just copy the prev commit code and compare it with the current version using the built-in compare with clipboard tool.

-3
Oct 21 '16 at 9:42 on
source share



All Articles