I have done one or the other. My personal experience is that intermediate commits provide low value. YMMV but I now know what works for me.
I definitely leave in commit A and a revert of commit A if I think it'll be useful.
The way I see it is I'm leaving breadcrumbs for myself for later. It's obvious that a sequence of keystrokes is useless (and most IDEs will undo a large number at once - correct behaviour) and that no history is useless so you have to find the thing that works for yourself or your team wherever.
I definitely leave in commit A and a revert of commit A if I think it'll be useful.
The way I see it is I'm leaving breadcrumbs for myself for later. It's obvious that a sequence of keystrokes is useless (and most IDEs will undo a large number at once - correct behaviour) and that no history is useless so you have to find the thing that works for yourself or your team wherever.