Re: [PATCH] checkout.txt: note about losing staged changes with --merge
From: Junio C Hamano <hidden>
Date: 2019-03-21 00:38:10
Elijah Newren [off-list ref] writes:
On Tue, Mar 19, 2019 at 7:50 PM Junio C Hamano [off-list ref] wrote:quoted
Duy Nguyen [off-list ref] writes:quoted
Kinda. But "--force --merge" makes no sense. --force discards all local changes by definition, which means you can't have conflicts and will not need --merge. I think this is the reason why we die() out when both are specified. So we need something like --discard-staged-changes-only...At that point, I would have to say that we do not need anything. The use case is already covered with "git reset && git checkout -m", isn't it?I guess the problem is just that 'git checkout -m' has not refused to run with either a dirty index or a dirty working tree, and if both are dirty (making us require more of a four-way merge), then our three-way merge has to ...
I didn't actually mean "nothing to do here" relative to the current code; instead, I meant "nothing more than just stop when the index has updates" (which is hard to read from the above quoted part, as "Kinda." is a response in a discussion started with my "checkout -m should probably refuse to do anything when the index is dirty").
So, I think we do need something (eventually at least). Would you prefer we dropped this patch from Duy and instead made 'checkout -m' abort when the index is dirty?
Let's go with the doc update first, as the patch has already written. I think in the longer term, just aborting when the index is dirty would be a vast improvement over the status quo + a doc update and is a good place to stop. Thanks.