Move cleanWorkingTree function to utils.

@devoncarew