Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a human-readable dump of .git/index?

Tags:

git

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.

like image 627
kjo Avatar asked Dec 24 '22 23:12

kjo


2 Answers

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

like image 54
twalberg Avatar answered Jan 05 '23 05:01

twalberg


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

% git ls-files --stage --debug
like image 23
kjo Avatar answered Jan 05 '23 06:01

kjo