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

Re: Suggestion: make git checkout safer

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 5, 2015, 18:03 UTC
Message-ID
<xmqqd21arq0n.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAPig+cTK4pXgweoGZc1-nj41aYo0bEK6Zrsc9291xQr5v8=p8g@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 7 quoted lines
> ...
> Again:
>
>     ...`hello.c` will also be restored,...
>
>>  because the file globbing is used to match entries in the index
>>  (not in the working tree by the shell).

Thanks for a thorough review. I agree with all the comments and suggestions you gave. Also, Ed, thanks for an attempt to improve the documentation.

I think the biggest problem with this patch is that the tone of the updated text is geared a lot more towards venting the initial frustration of the writer than helping the readers of the document.

By explaining what the behaviour is meant to solve and help, the readers would get useful information (e.g. "this is to be used to restore pristine contents"). The same thing said in the negative way only serve to unnecessarily repel readers (e.g. "this will unconditionally overwrite and lose contents").

Technically, they are the descriptions of the same thing---in order to restore pristine contents to the workng tree, you have to discard the botched changes you made in the working tree, and that is done "unconditionally" by "overwriting" and "losing contents". But saying it in the negative way does not serve as a useful warning.

The readers are intelligent, and they will understand (and will even appreciate) that a request to replace their botched contents in the working tree out of the index is done unconditionally without being asked an unnecessary "are you sure?" and done by overwriting the files, losing the botched contents from there, once they are explained why they want to "git checkout $paths", what the operation is meant to be used for.

Perhaps taking a deep breath and waiting for a few days for the head to coll down and frustrations to dissipate may be a good thing to do ;-)

Previous: Eric SunshineNext: Ed Avis
Message 20 of 28 in “Suggestion: make git checkout safer”
  1. Ed AvisJun 3, 2015
  2. Jeff KingJun 3, 2015
  3. Ed AvisJun 3, 2015
  4. Jeff KingJun 3, 2015
  5. Ed AvisJun 3, 2015
  6. Junio C HamanoJun 3, 2015
  7. Randall S. BeckerJun 3, 2015
  8. Junio C HamanoJun 3, 2015
  9. Randall S. BeckerJun 3, 2015
  10. Stefan BellerJun 3, 2015
  11. Ed AvisJun 4, 2015
  12. Ed AvisJun 4, 2015
  13. Torsten BögershausenJun 3, 2015
  14. Kevin DaudtJun 3, 2015
  15. Ed AvisJun 4, 2015
  16. Torsten BögershausenJun 4, 2015
  17. Ed AvisJun 5, 2015
  18. Duy NguyenJun 5, 2015
  19. Eric SunshineJun 5, 2015
  20. Junio C HamanoJun 5, 2015
  21. Ed AvisJun 5, 2015
  22. Eric SunshineJun 5, 2015
  23. Philip OakleyJun 3, 2015
  24. Junio C HamanoJun 3, 2015
  25. Jeff KingJun 3, 2015
  26. Randall S. BeckerJun 3, 2015
  27. Junio C HamanoJun 3, 2015
  28. John SzakmeisterJun 4, 2015

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.