gitgit-diffgit-difftool

Show Original File Names With git-difftool


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


Solution

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