Interesting to see someone doing this, it often comes up that we should actually have more levels of version control granularity than merges and commits. Just need an application of AI to generate good commit messages here :)
But thanks for the tip about Emacs undo tree, didn't know about that. With some add-ons you can apparently eg find undoable changes for only some region of a buffer, etc.
This is built into Emacs (no add-ons needed). Calling undo with a region selected undoes changes only in that region.