Git error on checkout: "fatal: reference is not a tree"

Viewed 19887

It all started when I decided to figure out why the project I'm working on weighs so much. I've run the following script:

git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| sed -n 's/^blob //p' \
| sort --numeric-sort --key=2 \
| cut -c 1-12,41- \
| $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest

And figured out which commits have the heaviest files. Next, I would like to see who is the author of those commits and when trying to run something like:

git show --stat COMMIT_HASH

I get a pile of gobbledygook and when I try rolling back to the commit, I get the above mentioned error.

So my question is: how do I find the author of the commit?

2 Answers

In my case, I run git fetch before checkout specific revision and it work.

Your git show command should work. Either the hash is not valid or the commit object has been corrupted in some way.

Updated: Your script returns object hashes, so probably the reference for that object is invalid somehow.

You wouldn't be able to get the author reference from there anyhow.

This might help, it will list all the commits where the object whose hash you provide has been modified:

git log --find-object=OBJECT_HASH

Related