gitwinmerge

WinMerge difftool makes changes only in AppData temporary files but not in the real files


I have WinMerge integrated with git as a difftool and a mergetool.

The thing is when I am running: git difftool SomeBranch..HEAD I get WinMerge opened up properly displaying the left and right side panes properly, but after resolving the diffs, I save and exit but the files are not affected. I noticed that when WinMerge gets opened I do see that all my diff is done against temporary files which are in AppData. Here is how the upper diff panes looks like (note the folder paths are AppData for both left and right side):

enter image description here

I cannot make WinMerge to really open the difftool properly and make me change/resolve my diffs and really save changes into the real files - Any Clues how to fix this?

Note: When "mergetool" this issue not occurs (only in difftool)

Note: When diffing against changes in my currect dir like this : git difftool - issue not happens (Winmerge presents the real file in the right pane and not a temp file)

Here is my .gitconfig file setup:

[mergetool]
    prompt = false
    keepBackup = false
    keepTemporaries = false

[merge]
    tool = winmerge

[mergetool "winmerge"]
    name = WinMerge
    trustExitCode = true
    cmd = "/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe" -u -e -dl \"Local\" -dr \"Remote\" $LOCAL $REMOTE

[diff]
    tool = winmerge

[difftool "winmerge"]
    name = WinMerge
    trustExitCode = true
    cmd = "/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe" -u -e $LOCAL $REMOTE

Other details:

WinMerge version: 2.16.6.0

OS: Windows 10

Git version: 2.24.1.windows.2


Solution

  • Editing files in the worktree works only if you compare a commit against the worktree files. When you run

    git difftool SomeBranch
    

    you compare the files on SomeBranch against the worktree, and you can edit the worktree files.

    But when you run

    git difftool SomeBranch..HEAD
    

    you compare two commits. git difftool treats them as unrelated to the worktree, so all your edits end up in the temporary files, as you have observed.