2

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?

develdevil
  • 297
  • 2
  • 15
  • Submodules are evil. See [Mastering Git submodules](https://medium.com/@porteneuve/mastering-git-submodules-34c65e940407) – IInspectable Sep 19 '17 at 22:26

1 Answers1

4

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".

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    This is good, and it essentially does what I'm asking for. It still has two medium-sized issues: it doesn't work for git difftool, and in my Git Bash (Windows) it screws up the terminal so that all text entered is not visible. But thank you. – develdevil Sep 20 '17 at 14:54
  • @develdevil Strange: what version of Git are you using? Is your Git bash using at least Lucida font? – VonC Sep 20 '17 at 14:57
  • @develdevil Note: `git difftool` (https://git-scm.com/docs/git-difftool) accepts the same options as `git diff`. So this should work with `git difftool` too. – VonC Sep 20 '17 at 14:58
  • git version 2.14.1.windows.1 - I realized the issue with the prompt was partially user error. I was using Ctrl-C to escape from vim instead of q. And when I run git difftool --submodule=diff it opens the submodule reference file in WinMerge instead of the changed files within the submodule. – develdevil Sep 20 '17 at 15:15
  • Update: Seems like everything is working these days when I run git difftool from within the subdirectory. Maybe all it needed was a reboot. – develdevil Nov 12 '17 at 20:01