Optimize commit

Use git status to check if the tree is clean. This optimizes git commit when there are no working changes.

@devoncarew PTAL thanks.