I tried reverting to a previous git commit with:
git revert xxx
I\'m now receiving this error as a response:
fatal: bad object
The reason I ran into it was simple. I was switching back and forth between the main repository and a submodule. I tried to do a diff between one hash (in the main repository) and another that I copied from SourceTree, thinking it was an easy to get the old HEAD (I had regressed one revision to track down a regression). The old HEAD hash I grabbed was that of a submodule, and git diff
was put out with me for feeding it garbage. That's how I ended up here, and that's when I realized it was operator error. If your hash is from a different repository git will scold you with this message. However, if you do feed it garbage, would it not be better to report "XXX not a revision in this repository"? It is every bit as general an error message as "bad object" and quite a bit less likely to send someone to stack overflow for answers. I wonder if the folks in the git community would accept that pull request...