Search code examples
windowsgitdiffgit-diffwinmerge

Git diff doesn't work within submodule


I'm on Windows 10, using Git command line and have WinMerge set up as my difftool.

I have a repository with several submodules. When running "git diff" and "git difftool" within the main repo, it correctly uses WinMerge to analyze the files. When I navigate to a submodule and run "git diff" or "git difftool" it does nothing.

Here's my .gitconfig:

[diff]
    tool = winmerge
[difftool "winmerge"]
    cmd = winmergeu -e \"$LOCAL\" \"$REMOTE\"

This is what I get when I git diff in the parent repo:

$ git diff
diff --git a/content/themes/baseline-theme b/content/themes/baseline-theme
--- a/content/themes/baseline-theme
+++ b/content/themes/baseline-theme
@@ -1 +1 @@
-Subproject commit 30901f86ba56be092f1ed5c7095204abe7f64b27
+Subproject commit 30901f86ba56be092f1ed5c7095204abe7f64b27-dirty

I get no output when I run the same command in the submodule.

How can I resolve this?


Solution

  • You would need at least Git 2.11 for git diff --submodule=diff to work.

    And 2.14 for it to work in submodules of submodules (ie recursively).
    See my answer "see diff of commit on submodule".