Improve Git commit behavior on replace()

Implement replace() instead of composing remove() and append(), so that
it performs not two independent but a single, concise transaction on the
storage backend. This is generally more efficient and especially
desirable when Git support is enabled.

This change also adds slightly more informative commit messages.