0

I use xxdiff with git-difftool, but other GUI diff tools have the same problem. Often, git-difftool has to save the files being compared as temporary files with names like /tmp/i2mLYu_MyHeader.h. That's for a file that, relative to the working tree, might be client/api/include/MyHeader.h. Diff tools like xxdiff display the names of the temporary files, usually in the title bar, or above each side of the diff. That makes it inconvenient to understand what file is being looked at, especially when more than one file has the same base name.

Is there a way to recover the original, tree-based paths, so they can be displayed instead? Having to write a wrapper around the diff tool would be fine.

Thanks.

Jim

Jim
  • 474
  • 5
  • 17
  • 2
    Unfortunately, I think the answer is no: the Git difftool code doesn't save the original path anywhere useful. As you've seen, it does at least attach the file's base name to the end of the temporary file. It would be nice if it passed the original name somewhere (in an env variable, perhaps?). I'm not entirely sure of this though as I never use `git difftool`. – torek May 23 '20 at 01:54

1 Answers1

2

If you want to compare two commits, or the changes in your whole worktree : try git difftool -d.

It will checkout two copies of the repo for comparison, and each individual file will have a relevant relative path name.

LeGEC
  • 46,477
  • 5
  • 57
  • 104
  • It's not exactly what I was after, but it's very close. A directory diff, like this provides, is even more useful in some ways, and the file and directory names are much more sensible. Thanks. – Jim May 24 '20 at 06:39