From: Arsh Srivastava Date: Tue, 10 Mar 2026 13:40:20 GMT Subject: Re: [PATCH 0/5] Advice on checkout dirty files Message-ID: In-Reply-To: As per the recommendation of Phillip Wood I have changed my files and added git checkout -m after understanding its significance :) On Tue, 10 Mar 2026 at 19:06, Junio C Hamano wrote: > > Phillip Wood 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... >