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

Re: [PATCH v3 0/6] doc: git-checkout: clarify DESCRIPTION section

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 3, 2025, 21:09 UTC
Message-ID
<xmqqikhzdz0k.fsf@gitster.g>
In-Reply-To
<pull.1962.v3.git.1756918202.gitgitgadget@gmail.com>
"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 6 quoted lines
>  * Improve the storytelling in the commit messages
>  * Take a different approach to the git checkout -b description (keep reset
>    in -B, but simplify the description of -B a lot)
>  * Make the description of git checkout [<branch>] more accurate.
>  * Try a different approach to git checkout file.txt ("Discard any unstaged
>    changes...")

Not just you repeat having bulleted list in your proposed log messages (which I already said something about, remember?), now you have them in your cover letter, too? You must be so fond of bulletted list X-<.

Show 7 quoted lines
>      @@ Documentation/git-checkout.adoc: $ git log -g -2 HEAD
>       -to checkout these paths out of the index.
>       +When you run `git checkout <something>`, Git tries to guess whether
>       +`<something>` is intended to be a branch, a commit, or a set of file(s),
>      -+and then switches branches, switches commits, or restores the files.
>      ++and then either switches to that branch or commit or restores the
>      ++specified files.
Much better.
>      ++	Switch to _<branch>_. This sets the current branch to _<branch>_ and
>      ++	updates the files in your working directory. Files which are
>      ++	identical in _<branch>_ and your current commit are left unchanged
>      ++	so that you can keep your uncommitted changes to those files.

Here "left unchanged" is technically correct, but somehow it gives me a (n incorrect) connotation that they are not modified since HEAD, which is not what you wanted to say at all. I recall that we once explained this not as "left unchanged", but as "changes follow you", and I found the explanation easier to absorb.

I cannot come up with a good way to remove duplicates in the following desciption, but what we want the reader to understand are twofold:

 * For paths that are not identical between HEAD and the _<branch>_
   you are switching to, you MUST NOT have a local change.  After
   you switch to _<branch>_, these paths in the working tree match
   that of the _<branch_>.  This is to avoid losing your local
   changes.
 * For paths that are identical between HEAD and the _<branch>_ you
   are switching to, you may have local modifications, and they
   follow you to the switched-to _<branch>_.
Show 10 quoted lines
>      ++`git checkout -b <new-branch> [<start-point>]`::
>      ++
>      ++	Create a new branch named _<new-branch>_, start it at _<start-point>_
>      ++	(defaults to the current commit), and check out the new branch.
>      ++	You can use the `--track` or `--no-track` options to set the branch's
>      ++	upstream tracking information.
>        +
>      ++This fails without making any changes if there's an error checking out
>      ++_<new-branch>_, for example if checking out the `<start-point>`
>      ++commit would overwrite your uncommitted changes.

OK. Do people understand "making a(ny) changes" refers to creation of the new branch, I have to wonder, but if so, the above is much much nicer than the original text.

    This fails without doing anything and without creating a new
    branch, if checking out the <start-point> has to overwrite your
    uncommitted changes.
might be slightly better?  I dunno.
Previous: Junio C HamanoNext: Julia Evans
Message 47 of 68 in “doc: git-checkout: clarify DESCRIPTION section”
  1. 0/5 doc: git-checkout: clarify DESCRIPTION sectionJulia Evans via GitGitGadget, Aug 25, 2025
  2. 1/5 doc: git-checkout: clarify introJulia Evans via GitGitGadget, Aug 25, 2025
  3. Junio C HamanoAug 26, 2025
  4. Junio C HamanoAug 26, 2025
  5. Julia EvansAug 26, 2025
  6. D. Ben KnobleAug 28, 2025
  7. Julia EvansAug 28, 2025
  8. Junio C HamanoAug 28, 2025
  9. D. Ben KnobleAug 29, 2025
  10. Junio C HamanoAug 29, 2025
  11. D. Ben KnobleSep 3, 2025
  12. 2/5 doc: git-checkout: clarify `git checkout <branch>`Julia Evans via GitGitGadget, Aug 25, 2025
  13. Junio C HamanoAug 26, 2025
  14. Julia EvansAug 28, 2025
  15. Junio C HamanoAug 28, 2025
  16. Julia EvansAug 28, 2025
  17. 3/5 doc: git-checkout: don't use "reset"Julia Evans via GitGitGadget, Aug 25, 2025
  18. 4/5 doc: git-checkout: deduplicate --detach explanationJulia Evans via GitGitGadget, Aug 25, 2025
  19. 5/5 doc: git-checkout: clarify restoring files sectionJulia Evans via GitGitGadget, Aug 25, 2025
  20. Junio C HamanoAug 26, 2025
  21. Julia EvansAug 28, 2025
  22. D. Ben KnobleAug 28, 2025
  23. Julia EvansAug 28, 2025
  24. Junio C HamanoAug 28, 2025
  25. D. Ben KnobleAug 29, 2025
  26. 0/5 doc: git-checkout: clarify DESCRIPTION sectionJulia Evans via GitGitGadget, Aug 29, 2025
  27. 1/5 doc: git-checkout: clarify introJulia Evans via GitGitGadget, Aug 29, 2025
  28. Junio C HamanoAug 29, 2025
  29. Julia EvansSep 2, 2025
  30. 2/5 doc: git-checkout: clarify `git checkout <branch>`Julia Evans via GitGitGadget, Aug 29, 2025
  31. Junio C HamanoAug 29, 2025
  32. Julia EvansSep 2, 2025
  33. 3/5 doc: git-checkout: don't use "reset"Julia Evans via GitGitGadget, Aug 29, 2025
  34. Junio C HamanoAug 29, 2025
  35. Julia EvansSep 1, 2025
  36. Junio C HamanoSep 2, 2025
  37. 4/5 doc: git-checkout: deduplicate --detach explanationJulia Evans via GitGitGadget, Aug 29, 2025
  38. 5/5 doc: git-checkout: clarify restoring files sectionJulia Evans via GitGitGadget, Aug 29, 2025
  39. 0/6 doc: git-checkout: clarify DESCRIPTION sectionJulia Evans via GitGitGadget, Sep 3, 2025
  40. 1/6 doc: git-checkout: clarify introJulia Evans via GitGitGadget, Sep 3, 2025
  41. 2/6 doc: git-checkout: clarify `git checkout <branch>`Julia Evans via GitGitGadget, Sep 3, 2025
  42. 3/6 doc: git-checkout: clarify `-b` and `-B`Julia Evans via GitGitGadget, Sep 3, 2025
  43. 4/6 doc: git-checkout: deduplicate --detach explanationJulia Evans via GitGitGadget, Sep 3, 2025
  44. 5/6 doc: git-checkout: split up restoring files sectionJulia Evans via GitGitGadget, Sep 3, 2025
  45. 6/6 doc: git-checkout: clarify restoring files sectionJulia Evans via GitGitGadget, Sep 3, 2025
  46. Junio C HamanoSep 3, 2025
  47. Junio C HamanoSep 3, 2025
  48. Julia EvansSep 3, 2025
  49. 0/7 doc: git-checkout: clarify DESCRIPTION sectionJulia Evans via GitGitGadget, Sep 10, 2025
  50. 1/7 doc: git-checkout: clarify intro sentenceJulia Evans via GitGitGadget, Sep 10, 2025
  51. 2/7 doc: git-checkout: clarify ARGUMENT DISAMBIGUATIONJulia Evans via GitGitGadget, Sep 10, 2025
  52. 3/7 doc: git-checkout: clarify `git checkout <branch>`Julia Evans via GitGitGadget, Sep 10, 2025
  53. 4/7 doc: git-checkout: clarify `-b` and `-B`Julia Evans via GitGitGadget, Sep 10, 2025
  54. Kristoffer HaugsbakkSep 29, 2025
  55. doc: git-checkout: fix placeholder markupkristofferhaugsbakk@fastmail.com, Oct 2, 2025
  56. doc: git-checkout: fix placeholder markupkristofferhaugsbakk@fastmail.com, Oct 16, 2025
  57. Julia EvansOct 17, 2025
  58. doc: git-checkout: fix placeholder markupkristofferhaugsbakk@fastmail.com, Oct 17, 2025
  59. 5/7 doc: git-checkout: deduplicate --detach explanationJulia Evans via GitGitGadget, Sep 10, 2025
  60. 6/7 doc: git-checkout: split up restoring files sectionJulia Evans via GitGitGadget, Sep 10, 2025
  61. 7/7 doc: git-checkout: clarify restoring files sectionJulia Evans via GitGitGadget, Sep 10, 2025
  62. Ben KnobleSep 11, 2025
  63. Julia EvansSep 12, 2025
  64. Kristoffer HaugsbakkSep 12, 2025
  65. Junio C HamanoSep 15, 2025
  66. Kristoffer HaugsbakkSep 16, 2025
  67. Junio C HamanoSep 12, 2025
  68. Junio C HamanoSep 17, 2025

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.