4

short version

How can I get a reasonably detailed, human-readable dump of .git/index?


tl;dr version

I have two index files, myrepo/.git/index and myrepo-copy/.git/index that are different according to diff ("Binary files ... differ").

I'd like to know more details on how the two index files differ.

Of course, I could look at the differences in the binary content, but I'm interested in something more immediately meaningful.

Therefore I'm looking for a way to get human-readable dumps of these two index files that I can compare with diff.

kjo
  • 33,683
  • 52
  • 148
  • 265

3 Answers3

7

I would suggest something along these lines:

diff <(GIT_INDEX_FILE=/path/to/index1 git ls-files --stage) <(GIT_INDEX_FILE=/path/to/index2 git ls-files --stage)

As you've already noted, you can add the --debug option to get info on timestamps and other stuff as well...

twalberg
  • 59,951
  • 11
  • 89
  • 84
5

OK, after I posted my question I learned that the following produces a fairly comprehensive dump of the index:

% git ls-files --stage --debug
kjo
  • 33,683
  • 52
  • 148
  • 265
0

The easiest to solve your problem is to commit the changes that are in one of the index files to a temporary branch, e.g.

git checkout -b temp
git commit

and then copy the other index file you have over .git/index. You can now use git status, git diff --staged etc to see the differences.

Sven Marnach
  • 574,206
  • 118
  • 941
  • 841