check for dirty working tree, handle failure to commit