Re: [PATCH 0/5] Advice on checkout dirty files
- From
Arsh Srivastava <arshsrivastava00@gmail.com>
- Date
- Mar 10, 2026, 13:40 UTC
- Message-ID
- <CAOAgETNoQuju_RWbe=jo8JF7J2+V_pVoyr6FeKw8LwYKi_HipA@mail.gmail.com>
- In-Reply-To
- <xmqqzf4fx0vo.fsf@gitster.g>
As per the recommendation of Phillip Wood <phillip.wood123@gmail.com> 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 <gitster@pobox.com> wrote:
Show 28 quoted lines
> > Phillip Wood <phillip.wood123@gmail.com> 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... >