You can have both, you know: you use git stash/Mercurial attic to shelve the parts of the change you don't want, test the result, commit, then reapply what you stashed. You get a clean history, and you can easily verify your source code works. This solution notably does not involve explicitly exposing the dirstate to the user.