MiJyn MiJyn - 1 month ago 15
Git Question

git diff between two different files

In

HEAD
(the latest commit), I have a file named
foo
. In my current working tree, I renamed it to
bar
, and also edited it.

I want to
git diff
foo
in
HEAD
, and
bar
in my current working tree.

Answer

Check out the --find-renames option 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

(Credit goes to twaggs from Git: How to diff two different files in different branches?)

Comments