
An effective way to have a clean and valuable commit history is to create the smallest valuable commit each time, with a descriptive commit message. This sounds obvious, but when you are in the midst of work things can get messy. Using Emacs Magit you can be highly selective as to what changes you include in each commit, down to individual characters.
This follows on from staging patches for cleaner commits with the command line,
git add -p
. Also see how to drive Git with Emacs and Magit for more background.