Subject: Re: [PATCH 0/5] Advice on checkout dirty files

From: Junio C Hamano <[email-masked]>
Date: Tue, 10 Mar 2026 06:36:11 -0700

Phillip Wood <[email-masked]> writes:

> If the intent is for the user to carry over the changes to the new 
> branch then recommending "git checkout -m" might be more convenient 
> rather than having to stash, checkout and unstash as three separate steps.

I personally would not recommend pushing "-m" to new people without
explaining its ramifications, though.

If "git stash pop" fails while a commit different from the original
is checked out, the working tree will get conflicts for you to
resolve, and that is the same as "git checkout -m".  But the
conflict may turn out to be too complex that you might not be able
to cleanly resolve.

With a "git stash pop" that gets interrupted by a conflict, the
stash entry is not removed from the stash, so there is a clean
recourse to "git reset --hard" away the conflict and attempting to
unstash (either to the same commit or to a different base).

With "git checkout -m", on the other hand, there is no such
recourse.  The conflicted working tree with the unmerged index is
all you get, and you get only a single chance to resolve it
correctly.

So...