2

When I run:

git difftool -d

It creates a temporary directory containing the files to be shown in the diff. The structure looks like this:

tmpdir/
  left/
    file1
  lindex
  right/
    file1
  rindex

The "left" and "right" directories are clear. But what are the "lindex" and "rindex" files? What do they contain? How can I view them? Sometimes there's no "rindex" but a "wtindex" file instead.

danvk
  • 15,863
  • 5
  • 72
  • 116
  • Probably need to mention (and tag) what tool you are actually using as `git difftool`... Then consult the documentation for that tool... – twalberg Jul 03 '14 at 17:01
  • When you pass "-d", the `git-difftool` command itself generates this directory structure before passing control to the diff tool itself. So this really is a `git-difftool` question. – danvk Jul 03 '14 at 18:46
  • @twalberg it's in the `git-difftool.perl` [source code](https://github.com/git/git/blob/v2.0.1/git-difftool.perl). –  Jul 07 '14 at 17:26

1 Answers1

3

They represent indexes, generated by git update-index in git-difftool.perl#L224-L248.

  • lindex represents LOCAL: A temporary file containing the contents of the file on the current branch.
  • rindex represents REMOTE: A temporary file containing the contents of the file to be merged.
  • wtindex represented MERGED (working tree): the result of the merge in progress

Those indexes are updated using --index-info in order to facilitate the diff between any locale modification you will be doing for each file, and the three versions mentioned above.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for the explanation. I was able to dump the contents of these files using [this script](https://gist.github.com/sriranggd/1144775). At the end of the day, they don't seem that interesting. There's nothing in them that you couldn't get from inspecting the files in the "left" and "right" directories. – danvk Jul 09 '14 at 15:26