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

Re: [PATCH] checkout: add --fetch to fetch remote before resolving start-point

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 24, 2026, 22:21 UTC
Message-ID
<xmqqeck4xan3.fsf@gitster.g>
In-Reply-To
<pull.2281.git.git.1777024991531.gitgitgadget@gmail.com>
"Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 10 quoted lines
> From: Harald Nordgren <haraldnordgren@gmail.com>
>
> Add a --fetch option to git checkout and git switch, plus a
> checkout.autoFetch config to enable it by default. When set and the
> start-point argument names a configured remote (either bare, like
> "origin", or prefixed, like "origin/foo"), fetch that remote before
> resolving the ref. Aborts the checkout if the fetch fails.
>
> Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
> ---

It is true that "checkout" does funny things to special case the remote-tracking branches, like setting up the branch.<name>.merge configuration or even inferring the name of the local branch to be created.

But I have to say that this one, especially the configuration variable, goes way too far. The usual uses of remote-tracking branch names, e.g.,

    git log -1 origin/master
    git grep frotz origin/master
    git rev-list --count origin/maint..origin/master

to name a specific object all assume and rely on the stability of them. Should the configuration cause a fetch to happen before any of these uses of remote-tracking branches for consistency?

Previous: Harald NordgrenNext: Junio C Hamano
Message 15 of 73 in “checkout: add --fetch to fetch remote before resolving start-point”
  1. checkout: add --fetch to fetch remote before resolving start-pointHarald Nordgren via GitGitGadget, Apr 24, 2026
  2. Ramsay JonesApr 24, 2026
  3. D. Ben KnobleApr 24, 2026
  4. Comments on Phillip's reviewHarald Nordgren, Apr 25, 2026
  5. Wrong subject lineHarald Nordgren, Apr 25, 2026
  6. Harald NordgrenJun 18, 2026
  7. D. Ben KnobleJun 18, 2026
  8. Kristoffer HaugsbakkApr 24, 2026
  9. Comments on Phillip's reviewHarald Nordgren, Apr 25, 2026
  10. Wrong subject lineHarald Nordgren, Apr 25, 2026
  11. Kristoffer HaugsbakkApr 26, 2026
  12. Harald NordgrenApr 26, 2026
  13. Marc BranchaudApr 24, 2026
  14. Wrong subject lineHarald Nordgren, Apr 25, 2026
  15. Junio C HamanoApr 24, 2026
  16. Junio C HamanoApr 25, 2026
  17. Multiple remotesHarald Nordgren, Apr 25, 2026
  18. Ben KnobleApr 25, 2026
  19. ghHarald Nordgren, Apr 25, 2026
  20. checkout: add --fetch to fetch remote before resolving start-pointHarald Nordgren via GitGitGadget, Apr 25, 2026
  21. checkout: add --fetch to fetch remote before resolving start-pointHarald Nordgren via GitGitGadget, Apr 26, 2026
  22. Ramsay JonesApr 26, 2026
  23. checkout: add --fetch to fetch remote before resolving start-pointHarald Nordgren via GitGitGadget, Apr 26, 2026
  24. Junio C HamanoApr 28, 2026
  25. Harald NordgrenApr 28, 2026
  26. checkout: extend --track with a "fetch" mode to refresh start-pointHarald Nordgren via GitGitGadget, Apr 28, 2026
  27. Junio C HamanoMay 3, 2026
  28. checkout: add --autostash option for branch switchingHarald Nordgren, May 3, 2026
  29. checkout: extend --track with a "fetch" mode to refresh start-pointHarald Nordgren via GitGitGadget, May 3, 2026
  30. checkout: extend --track with a "fetch" mode to refresh start-pointHarald Nordgren, May 7, 2026
  31. Phillip WoodMay 8, 2026
  32. checkout: add --fetch to fetch remote before resolving start-pointHarald Nordgren, May 8, 2026
  33. Harald NordgrenJun 18, 2026
  34. checkout: extend --track with a "fetch" mode to refresh start-pointHarald Nordgren via GitGitGadget, May 8, 2026
  35. Phillip WoodMay 11, 2026
  36. checkout: extend --track with a "fetch" mode to refresh start-pointHarald Nordgren via GitGitGadget, May 11, 2026
  37. Junio C HamanoMay 12, 2026
  38. Harald NordgrenMay 18, 2026
  39. checkout: extend --track with a "fetch" mode to refresh start-pointHarald Nordgren via GitGitGadget, May 12, 2026
  40. checkout: extend --track with a "fetch" mode to refresh start-pointHarald Nordgren via GitGitGadget, May 18, 2026
  41. Junio C HamanoMay 19, 2026
  42. Harald NordgrenMay 19, 2026
  43. Junio C HamanoMay 19, 2026
  44. Harald NordgrenMay 19, 2026
  45. Harald NordgrenMay 19, 2026
  46. checkout: extend --track with a "fetch" mode to refresh start-pointHarald Nordgren via GitGitGadget, May 19, 2026
  47. Junio C HamanoMay 19, 2026
  48. Phillip WoodMay 21, 2026
  49. Harald NordgrenMay 21, 2026
  50. Junio C HamanoMay 21, 2026
  51. Phillip WoodMay 21, 2026
  52. Junio C HamanoMay 21, 2026
  53. Harald NordgrenJun 13, 2026
  54. checkout: extend --track with a "fetch" mode to refresh start-pointHarald Nordgren via GitGitGadget, May 21, 2026
  55. 0/2 checkout: --track=fetchHarald Nordgren via GitGitGadget, May 23, 2026
  56. 1/2 branch: expose helpers for finding the remote owning a tracking refHarald Nordgren via GitGitGadget, May 23, 2026
  57. 2/2 checkout: extend --track with a "fetch" mode to refresh start-pointHarald Nordgren via GitGitGadget, May 23, 2026
  58. Junio C HamanoJun 17, 2026
  59. Harald NordgrenJun 17, 2026
  60. Junio C HamanoJun 18, 2026
  61. 0/2 checkout: --track=fetchHarald Nordgren via GitGitGadget, Jun 18, 2026
  62. 1/2 branch: expose helpers for finding the remote owning a tracking refHarald Nordgren via GitGitGadget, Jun 18, 2026
  63. 2/2 checkout: extend --track with a "fetch" mode to refresh start-pointHarald Nordgren via GitGitGadget, Jun 18, 2026
  64. Phillip WoodJun 23, 2026
  65. Harald NordgrenJun 23, 2026
  66. Junio C HamanoJun 24, 2026
  67. Ben KnobleJun 25, 2026
  68. Harald NordgrenJun 25, 2026
  69. Kristofer KarlssonJun 25, 2026
  70. 0/2 checkout: --track=fetchHarald Nordgren via GitGitGadget, Jun 24, 2026
  71. 1/2 branch: expose helpers for finding the remote owning a tracking refHarald Nordgren via GitGitGadget, Jun 24, 2026
  72. 2/2 checkout: extend --track with a "fetch" mode to refresh start-pointHarald Nordgren via GitGitGadget, Jun 24, 2026
  73. Junio C HamanoJul 23, 2026

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.