How many times can you spot the letter "e" in:
Q: How robust are Git commits when the power goes out? One day I was using Git (I'm still using it) and the electricity went down while I was committing.
When I (actually, the electricity) came back, the git repo was corrupt. I don't remember the exact name, but it was something like "invalid refs" or something like that.
It's easy to guess that the commit was broken in the middle of the operation (I was committing through IntelliJ, which does the index additions automatically). It was also easy to guess that, actually, 'commit' is not as ACID as the DBMS operation with the same name.
Q: Is there a way to ensure repo-altering operations respect atomicity? i.e. if the electricity goes down again, and I'm committing, I'd like my filesystem to not be in a corrupt state.

A: I don't know if there is a way to make Git commits survive perfectly timed power failures, but you might be able to fix your repository.
Git objects are supposed to be immutable, so all your older commits should still be valid. According to this answer, you can change the hash in .git/refs/heads/<branch-name> to change the head of the branch you were working on to the previous commit(you can see them in .git/logs/HEAD).
The comment to that answer says that this method "Still leaves repository in broken state, but this allows to recover it". I'm did not test this(no idea how to replicate your situation), but I assume the recovery is done via git gc, that will delete the corrupted commit.

A: Git's storage system isn't transactional, so there's definitely a chance that a hardware problem could leave things in an inconsistent state. On the other hand, Git is also really fast so you'd have to be really unlucky to be hit by problems of the “power failure” kind (systematic problems with the disk are something else). The speed comes in part precisely from the fact that it isn't transactional; transactions are really quite expensive since they have to wait for confirmation back from the disk that it has written the data. (Databases do all sorts of things to try to conceal this cost, but ultimately they still pay the price. Some of the competitor DVCSes are transactional, and yes, they're quite a bit slower on the same hardware as git.)
In the worst case — a total catastrophic disk failure (which I've seen happen) — the only way for any DVCS to recover is to use the fact that it is distributed. If you've pushed your changes up until very recently to another system and they've shared them to many different hosts, recovery is just a matter of using one of these other places as an artefact source, a place to pull your branches from (even if just temporarily). Like that you'll pull the history of the interesting branches back in and you'll be able to get working again very quickly; anything that wipes out lots of distributed copies of your repo at once is either a disaster of the kind where you don't worry about programming afterwards (think major meteorite impact) or is outright enemy action. (Try not to make such enemies…) This is in total contrast to non-distributed systems, where losing the central server that hosts everything is a fatal blow.

user
In that passage, there are two hundred and eighty-one occurrences of the letter "e."
assistant