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

Re: Suggestion: make git checkout safer

From
John Szakmeister <john@szakmeister.net>
Date
Jun 4, 2015, 09:01 UTC
Message-ID
<CAEBDL5XcEWpXeVjYb9spvy1QHbODbuvcXxFRp7_-hq=RNemyXA@mail.gmail.com>
In-Reply-To
<xmqqiob4wkem.fsf@gitster.dls.corp.google.com>

On Wed, Jun 3, 2015 at 5:29 PM, Junio C Hamano <gitster@pobox.com> wrote: [snip]

Show 16 quoted lines
> [Footnote]
>
> *1* In the context of this discussion, after screwing up the change
>     in hello.c, instead of expressing the wish to recover and to
>     start from scratch in two separate commands, i.e.
>
>         rm hello.c && update-from-scm
>
>     they will learn to use a single command that is designed for
>     that purpose, i.e.
>
>         checkout-from-scm hello.c
>
>     without the "rm" step, which _is_ an artificial workaround for
>     their other SCMs that do not update from the repository unless
>     they remove the files.

Just to be clear, Subversion doesn't require you to remove the file to restore it (I'm sure most of you know that, but just in case others didn't). There is a one-step way to restore the file:

    svn revert hello.c

Unfortunately, revert in the Git sense is about reverting commits, so there's a bit of friction between Subversion and Git's terminology. OTOH, once the team was educated how to think about it, "git checkout <path>" has been pretty natural to use.

-John
Previous: Junio C Hamano
Message 28 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.