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
Marc Branchaud <marcnarc@xiplink.com>
Date
Mar 14, 2014, 14:33 UTC
Message-ID
<5323131C.7070506@xiplink.com>
In-Reply-To
<1394771872-25940-4-git-send-email-andrew.kw.w@gmail.com>
On 14-03-14 12:37 AM, Andrew Wong wrote:
Show 6 quoted lines
> During a merge, "--mixed" is most likely not what the user wants. Using
> "--mixed" during a merge would leave the merged changes and new files
> mixed in with the local changes. The user would have to manually clean
> up the work tree, which is non-trivial. In future releases, we want to
> make "git reset" error out when used in the middle of a merge. For now,
> we simply print out a warning to the user.

I know this approach was suggested earlier, but given these dangers it seems silly to give this big warning on a plain "git reset" but still go ahead and do the things the warning talks about.

Is there any issue with changing "git reset" to error-out now but letting "git reset --mixed" proceed? Something like (note the reworded warning message):

$ git reset Cowardly refusing to implicitly run 'git reset --mixed' during a merge. This would not clean up any merged changes and would not remove any new files that were created in the work tree. It would also make it impossible for git to automatically clean up the work tree later, so you would have to clean up the work tree manually. You probably meant to run 'git merge --abort' instead. $ git reset --mixed # Stoopid git! I know what I'm doing! $

This would mean that the 10% of git users who like to do "git reset" in the middle of a conflicted merge will have to teach their fingers some extra motions. But these users are all veterans, and they can more easily type in 8 extra characters (6 with completion) than new users can recover from accidentally misusing git-reset's power.

		M.
Previous: Andrew WongNext: Andrew Wong
Message 7 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.