Subject: Re: [PATCH] checkout: add --autostash option for branch switching

From: Harald Nordgren <[email-masked]>
Date: Tue, 31 Mar 2026 14:16:33 +0200

> FWIW, I very much like what I see in 
> 
>    $ git checkout hn/git-checkout-m-with-stash && git diff @{1}
> 
> output.  It is great that we do not have to do any dry-run, because
> the "real" run safely aborts, we can do the "stash && merge && unstash"
> dance as a fallback instead.  All the credit goes to Phillip and you
> for the idea and the execution of this.
> 
> I do use "checkout -m" a few times a week, but I do not do anything
> complex with submodules or run the command with unrelated local
> modifications, so there may be changes in behaviour I haven't seen
> in corner cases that I do not exercise.

I wonder if my implementation is not really up to par. I have ran into a
few "conflicts", were 'git stash pop' simply worked afterwards.

So not quite production ready.

Harald