Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Ramsay Jones <ramsay@ramsayjones.plus.com>,
	 "D. Ben Knoble" <ben.knoble@gmail.com>,
	 Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
	 Marc Branchaud <marcnarc@gmail.com>,
	Harald Nordgren <haraldnordgren@gmail.com>
Subject: Re: [PATCH v4] checkout: add --fetch to fetch remote before resolving start-point
Date: Tue, 28 Apr 2026 10:47:22 +0900	[thread overview]
Message-ID: <xmqqwlxrzwid.fsf@gitster.g> (raw)
In-Reply-To: <pull.2281.v4.git.git.1777228346809.gitgitgadget@gmail.com> (Harald Nordgren via GitGitGadget's message of "Sun, 26 Apr 2026 18:32:26 +0000")

"Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Harald Nordgren <haraldnordgren@gmail.com>

> A common workflow is:
>
>     git fetch origin
>     git checkout -b new_branch origin/some-branch
>
> The first command exists purely so the second sees an up-to-date view
> of the remote.

This is only half true, isn't it?

Git is among projects that encourage forking only from a well-known
point in history (like the latest released version), not at a random
"tip of the day" commit from the upstream.

Such projects also tend to discourage people from constantly pulling
updated upstream into their unfinished topic branch, or rebase their
unfinished topic branch on top of updated upstream, only to "catch
up", and instead encourage them to make a trial merge to notice when
the base got too stale to cause eventual merge to conflict too much,
and when it happens, make such a back-merge, but otherwise keep
working on the stable base and avoid such "catching up".

And when working with such a project, what users who do the above is
forgetting is to inspect origin/master between the two steps to see
if it is a good commit to start your topic at.

> If it is forgotten, origin/some-branch points at a stale commit
> and the new local branch is created from the wrong start point.

So this part is not quite true.  What makes your topic begin at a
wrong starting point is not that you forget to fetch, but you forget
to verify what you fetched and think if it is a good starting point.

And for that verification to happen, you do not want "checkout" and
"fetch" mixed into one.

On the other hand, if you are allowed to fork at anywhere (as
opposed to a latest release), then not fetching and building on top
of slightly older codebase is not such a huge deal, as you're likely
to be making the "catch up" changes on top of your unfinished work
later anyway.

So as I already said before, I am fairly negative on this topic.  It
feels more like a knob to allow and actively encourage people to be
more sloppy than anything else.

I may have already pointed this out (but I do not remember), but
this option would not make any sense when --track is not in effect,
so instead of adding a brand new option, making it an extension to
the existing --track option might make it slightly more palatable.


  reply	other threads:[~2026-04-28  1:47 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-24 10:03 [PATCH] checkout: add --fetch to fetch remote before resolving start-point Harald Nordgren via GitGitGadget
2026-04-24 13:48 ` Ramsay Jones
2026-04-24 17:12 ` D. Ben Knoble
2026-04-25 17:24   ` Comments on Phillip's review Harald Nordgren
2026-04-25 17:44     ` Wrong subject line Harald Nordgren
2026-04-24 17:38 ` [PATCH] checkout: add --fetch to fetch remote before resolving start-point Kristoffer Haugsbakk
2026-04-25 17:41   ` Comments on Phillip's review Harald Nordgren
2026-04-25 17:44     ` Wrong subject line Harald Nordgren
2026-04-26  7:07       ` Kristoffer Haugsbakk
2026-04-26 15:15         ` [PATCH] remote: add --set-head option to 'git remote add' Harald Nordgren
2026-04-24 17:42 ` [PATCH] checkout: add --fetch to fetch remote before resolving start-point Marc Branchaud
2026-04-25 17:48   ` Wrong subject line Harald Nordgren
2026-04-24 22:21 ` [PATCH] checkout: add --fetch to fetch remote before resolving start-point Junio C Hamano
2026-04-25  2:54   ` Junio C Hamano
2026-04-25 17:58     ` Multiple remotes Harald Nordgren
2026-04-25 21:57       ` Ben Knoble
2026-04-25 22:54         ` gh Harald Nordgren
2026-04-25 18:12 ` [PATCH v2] checkout: add --fetch to fetch remote before resolving start-point Harald Nordgren via GitGitGadget
2026-04-26  7:24   ` [PATCH v3] " Harald Nordgren via GitGitGadget
2026-04-26 15:54     ` Ramsay Jones
2026-04-26 18:32     ` [PATCH v4] " Harald Nordgren via GitGitGadget
2026-04-28  1:47       ` Junio C Hamano [this message]
2026-04-28  8:44         ` [PATCH] " Harald Nordgren
2026-04-28  9:03       ` [PATCH v5] checkout: extend --track with a "fetch" mode to refresh start-point Harald Nordgren via GitGitGadget
2026-05-03 20:59         ` Junio C Hamano
2026-05-03 22:32           ` [PATCH] checkout: add --autostash option for branch switching Harald Nordgren
2026-05-03 22:31         ` [PATCH v6] checkout: extend --track with a "fetch" mode to refresh start-point Harald Nordgren via GitGitGadget
2026-05-07 20:12           ` Harald Nordgren
2026-05-08 13:15             ` Phillip Wood
2026-05-08 22:40               ` [PATCH] checkout: add --fetch to fetch remote before resolving start-point Harald Nordgren
2026-05-08 22:52           ` [PATCH v7] checkout: extend --track with a "fetch" mode to refresh start-point Harald Nordgren via GitGitGadget
2026-05-11 13:16             ` Phillip Wood
2026-05-11 13:47             ` [PATCH v8] " Harald Nordgren via GitGitGadget
2026-05-12  0:32               ` Junio C Hamano
2026-05-12 10:55               ` [PATCH v9] " Harald Nordgren via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqwlxrzwid.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=haraldnordgren@gmail.com \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=marcnarc@gmail.com \
    --cc=ramsay@ramsayjones.plus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox