From: "Julia Evans" <julia@jvns•ca>
To: "Junio C Hamano" <gitster@pobox•com>,
"Julia Evans" <gitgitgadget@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH 2/5] doc: git-checkout: clarify `git checkout <branch>`
Date: Thu, 28 Aug 2025 08:11:11 -0400 [thread overview]
Message-ID: <276630b8-ad98-4ada-aa85-9f136d653d7b@app.fastmail.com> (raw)
In-Reply-To: <xmqqldn5ix0r.fsf@gitster.g>
> Do we expect readers to truly understand what is to "switch to branch"
> without explanation? IOW, I am undecided if the lost "To prepare for
> working on" is a good thing.
I'm not sure what you mean here: "switch to <branch>" is as far as I can tell
the most widely used term to refer to this operation, in other Git
resources, in Git's own man pages, and in the error output of the
`git checkout` command itself:
("Please commit your changes or stash them before you switch branches.")
Which readers do you think would be confused by it?
> Usually with "changes on _<branch>_", people mean quite a different
> thing from what the above paragraph refers to.
>
> Imagine that you are on a branch that you forked from 'main' some
> time ago, built a handful of commits, among which there may be ones
> that touch file F. You further have local modification to file F.
> Now you want to switch to another branch. That branch, since it
> forked from 'main', never touched F. Your local changes do not
> conflict with "the changes on branch" (there is no changes on branch
> to conflict with your work, as F stayed the same).
>
> To improve, "with the changes on _<branch>_" should be phrased more like
> "with the differences between the current state and that of the
> _<branch>_" or something.
That makes sense. I'll work on a better way to phrase this.
> I do not think "glorified no-op" is a reference to "status". At least,
> when I wrote it, I didn't mean it that way to compare this glorified
> no-op with "git status" [*]. It is a reference to "even though you are
> invoking the 'checkout' command, you are not checking out anything."
> The side effect is to see the tracking information, which is "rather
> expensive side-effects"---compared to doing nothing, anything is
> expensive ;-).
>
> I strongly suspect that running "git status" is much more costly than
> "git checkout", simply because the former has to do a lot more than just
> peeking the tracking information; it internally runs diff between HEAD
> and the index, and between the index and the working tree, and it also
> has to find and list untracked paths. Both commands compute the
> tracking info by calling the same remote.c::format_tracking_info()
> function.
Ah, I thought `git status` was faster because I benchmarked it it on one
of my repositories and got these results [1].
Now that I see that that's not what "expensive side-effects" was intended
to mean, will change to something much simpler, like "Running `git checkout`
without specifying a branch outputs the tracking information for the current
branch. It has no other effect. "
- Julia
[1]
$ hyperfine 'git status'
Benchmark 1: git status
Time (mean ± σ): 6.6 ms ± 1.2 ms [User: 3.2 ms, System: 5.1 ms]
$ hyperfine 'git checkout'
Time (mean ± σ): 29.5 ms ± 1.9 ms [User: 12.6 ms, System: 14.8 ms]
next prev parent reply other threads:[~2025-08-28 12:11 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 19:08 [PATCH 0/5] doc: git-checkout: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-25 19:08 ` [PATCH 1/5] doc: git-checkout: clarify intro Julia Evans via GitGitGadget
2025-08-26 18:46 ` Junio C Hamano
2025-08-26 18:51 ` Junio C Hamano
2025-08-26 20:56 ` Julia Evans
2025-08-28 14:00 ` D. Ben Knoble
2025-08-28 22:34 ` Julia Evans
2025-08-28 23:44 ` Junio C Hamano
2025-08-29 13:39 ` D. Ben Knoble
2025-08-29 21:00 ` Junio C Hamano
2025-09-03 23:48 ` D. Ben Knoble
2025-08-25 19:08 ` [PATCH 2/5] doc: git-checkout: clarify `git checkout <branch>` Julia Evans via GitGitGadget
2025-08-26 21:38 ` Junio C Hamano
2025-08-28 12:11 ` Julia Evans [this message]
2025-08-28 15:45 ` Junio C Hamano
2025-08-28 18:24 ` Julia Evans
2025-08-25 19:08 ` [PATCH 3/5] doc: git-checkout: don't use "reset" Julia Evans via GitGitGadget
2025-08-25 19:08 ` [PATCH 4/5] doc: git-checkout: deduplicate --detach explanation Julia Evans via GitGitGadget
2025-08-25 19:08 ` [PATCH 5/5] doc: git-checkout: clarify restoring files section Julia Evans via GitGitGadget
2025-08-26 22:43 ` Junio C Hamano
2025-08-28 13:26 ` Julia Evans
2025-08-28 19:08 ` D. Ben Knoble
2025-08-28 19:59 ` Julia Evans
2025-08-28 20:38 ` Junio C Hamano
2025-08-29 13:48 ` D. Ben Knoble
2025-08-29 11:45 ` [PATCH v2 0/5] doc: git-checkout: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-29 11:45 ` [PATCH v2 1/5] doc: git-checkout: clarify intro Julia Evans via GitGitGadget
2025-08-29 15:58 ` Junio C Hamano
2025-09-02 17:14 ` Julia Evans
2025-08-29 11:45 ` [PATCH v2 2/5] doc: git-checkout: clarify `git checkout <branch>` Julia Evans via GitGitGadget
2025-08-29 16:03 ` Junio C Hamano
2025-09-02 17:16 ` Julia Evans
2025-08-29 11:45 ` [PATCH v2 3/5] doc: git-checkout: don't use "reset" Julia Evans via GitGitGadget
2025-08-29 16:22 ` Junio C Hamano
2025-09-01 14:28 ` Julia Evans
2025-09-02 16:10 ` Junio C Hamano
2025-08-29 11:45 ` [PATCH v2 4/5] doc: git-checkout: deduplicate --detach explanation Julia Evans via GitGitGadget
2025-08-29 11:45 ` [PATCH v2 5/5] doc: git-checkout: clarify restoring files section Julia Evans via GitGitGadget
2025-09-03 16:49 ` [PATCH v3 0/6] doc: git-checkout: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-09-03 16:49 ` [PATCH v3 1/6] doc: git-checkout: clarify intro Julia Evans via GitGitGadget
2025-09-03 16:49 ` [PATCH v3 2/6] doc: git-checkout: clarify `git checkout <branch>` Julia Evans via GitGitGadget
2025-09-03 16:49 ` [PATCH v3 3/6] doc: git-checkout: clarify `-b` and `-B` Julia Evans via GitGitGadget
2025-09-03 16:50 ` [PATCH v3 4/6] doc: git-checkout: deduplicate --detach explanation Julia Evans via GitGitGadget
2025-09-03 16:50 ` [PATCH v3 5/6] doc: git-checkout: split up restoring files section Julia Evans via GitGitGadget
2025-09-03 16:50 ` [PATCH v3 6/6] doc: git-checkout: clarify " Julia Evans via GitGitGadget
2025-09-03 21:29 ` Junio C Hamano
2025-09-03 21:09 ` [PATCH v3 0/6] doc: git-checkout: clarify DESCRIPTION section Junio C Hamano
2025-09-03 21:28 ` Julia Evans
2025-09-10 19:14 ` [PATCH v4 0/7] " Julia Evans via GitGitGadget
2025-09-10 19:14 ` [PATCH v4 1/7] doc: git-checkout: clarify intro sentence Julia Evans via GitGitGadget
2025-09-10 19:14 ` [PATCH v4 2/7] doc: git-checkout: clarify ARGUMENT DISAMBIGUATION Julia Evans via GitGitGadget
2025-09-10 19:14 ` [PATCH v4 3/7] doc: git-checkout: clarify `git checkout <branch>` Julia Evans via GitGitGadget
2025-09-10 19:14 ` [PATCH v4 4/7] doc: git-checkout: clarify `-b` and `-B` Julia Evans via GitGitGadget
2025-09-29 18:07 ` Kristoffer Haugsbakk
2025-10-02 18:37 ` [PATCH] doc: git-checkout: fix placeholder markup kristofferhaugsbakk
2025-10-16 22:11 ` [PATCH resend] " kristofferhaugsbakk
2025-10-17 13:56 ` Julia Evans
2025-10-17 15:50 ` [PATCH v2] " kristofferhaugsbakk
2025-09-10 19:14 ` [PATCH v4 5/7] doc: git-checkout: deduplicate --detach explanation Julia Evans via GitGitGadget
2025-09-10 19:14 ` [PATCH v4 6/7] doc: git-checkout: split up restoring files section Julia Evans via GitGitGadget
2025-09-10 19:14 ` [PATCH v4 7/7] doc: git-checkout: clarify " Julia Evans via GitGitGadget
2025-09-11 13:01 ` [PATCH v4 0/7] doc: git-checkout: clarify DESCRIPTION section Ben Knoble
2025-09-12 14:05 ` Julia Evans
2025-09-12 14:26 ` Kristoffer Haugsbakk
2025-09-15 23:22 ` Junio C Hamano
2025-09-16 6:41 ` Kristoffer Haugsbakk
2025-09-12 16:23 ` Junio C Hamano
2025-09-17 18:38 ` Junio C Hamano
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=276630b8-ad98-4ada-aa85-9f136d653d7b@app.fastmail.com \
--to=julia@jvns$(echo .)ca \
--cc=git@vger$(echo .)kernel.org \
--cc=gitgitgadget@gmail$(echo .)com \
--cc=gitster@pobox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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