git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] reset: Print a warning when user uses "git reset" during a merge

From
Andrew Wong <andrew.kw.w@gmail.com>
Date
Mar 14, 2014, 21:35 UTC
Message-ID
<CADgNjakXANkNPyO6n5CH3=R-Heuf2qQ0STyJU4zSgTw63C19-A@mail.gmail.com>
In-Reply-To
<xmqqa9csh54f.fsf@gitster.dls.corp.google.com>
On Fri, Mar 14, 2014 at 4:55 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 6 quoted lines
>> For the users that really did mean "--merge", the warning is silly.
>> It's basically saying "We know that you're about to mess up your work
>> tree, but we let you mess up anyway. Learn the correct way so that you
>> don't mess up next time".
>
> I suspect that you meant "--mixed" instead of "--merge" here.

No, I did mean "--merge". It's silly for inexperienced users because it's too late to use "--merge" by the time they realized they should not have used the default. The work tree has already become a mess. So they'd immediately think "if git was smart enough to warn me about the mess, why not prevent me from getting into the mess in the first place?"

For the experienced users, they would understand the warning, because they would be aware of the index, and the effect that "--mixed" and "--merge" have on it.

> So I am OK with "eventually error out by default", but not OK with
> "we know better than the user and will not allow it at all".

Again, I didn't mean "we know better than the user". However, from a new user's perspective, they won't understand why "git reset" gives the warning, but still "knowingly" messes up their work tree.

And "we don't know better than the user" is exactly why I think we should "eventually error out" rather than automatically switching to "--merge". As Matthieu was saying, automatically switching to "--merge" could discard conflict resolutions, which would be undesirable. So it's better for git to error out then having git decides what the user (probably) wants.

Previous: Junio C HamanoNext: Marc Branchaud
Message 10 of 15 in “Make git more user-friendly during a merge conflict”
  1. 0/3 Make git more user-friendly during a merge conflictAndrew Wong, Mar 14, 2014
  2. 1/3 wt-status: Make status messages more consistent with othersAndrew Wong, Mar 14, 2014
  3. Junio C HamanoMar 17, 2014
  4. 2/3 merge: Advise user to use "git merge --abort" to abort mergesAndrew Wong, Mar 14, 2014
  5. Junio C HamanoMar 17, 2014
  6. 3/3 reset: Print a warning when user uses "git reset" during a mergeAndrew Wong, Mar 14, 2014
  7. Marc BranchaudMar 14, 2014
  8. Andrew WongMar 14, 2014
  9. Junio C HamanoMar 14, 2014
  10. Andrew WongMar 14, 2014
  11. Marc BranchaudMar 15, 2014
  12. Junio C HamanoMar 17, 2014
  13. Junio C HamanoMar 17, 2014
  14. Andrew WongMar 17, 2014
  15. Junio C HamanoMar 19, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.