Implement autostash option and improve logging