🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #4148

Re: [PATCH v2] doc: add tutorial on branches for beginners

#4148
From: "D. Ben Knoble"
Date: Mon, 30 Nov 2026 17:00
100 lines
15973 bytes
On Mon, Nov 30, 2026 at 11:10 AM Julia Evans <julia@jvns.ca> wrote:
>
> >> +Step 8: Create another branch
> >> +-----------------------------
> >> +
> >> +Now create a second branch called `add-animals`. We're creating two
> >> +branches to show what the process of working on multiple changes at the
> >> +same time looks like.
> >> +
> >> +You'll usually want to start all new branches from the `main` branch
> >> +to keep your branches independent from each other. Right now
> >> +we're on the `add-fruits` branch, so we need to switch back to the
> >> +`main` branch:
> >> +
> >> +-----
> >> +$ git switch main
> >> +-----
> >> +
> >> +Then create a branch called `add-animals`.
> >> +
> >> +-----
> >> +$ git switch -c add-animals
> >> +-----
> > I assume we are choosing not to teach "git switch -c add-animals main" for some
> > reason here?
> >
> > One reason I can imagine is that, depending on config like branch.autoSetupMerge
> > and the shape of the 2nd argument (main with config=inherit, origin/main with
> > default config, etc.), we end up configuring an upstream, and you said this
> > tutorial intentionally omits that. So while someone following the tutorial who
> > has not configured branch.autoSetupMerge away from the default would not have
> > any surprising upstream behavior from "git switch -c add-animals main" we cannot
> > control what will or won't happen, which might be confusing.
> >
> > Is that what you were thinking, or something else?
>
> I'd never heard of the syntax 'git switch -c add-animals main' until
> right now! :)

Aha, I suspected that was an option, too :)

> My first reaction upon seeing that is that I'd be quite reluctant to use
> it or recommend it because I very often hear from users that when a
> command has 2 arguments that need to be specified in an order it's hard
> for them to remember the order. For example with 'git checkout main --
> file.txt' or 'ln -s file1.txt file2.txt'. Personally I don't think I
> could remember the order of the arguments without looking it up (in 'git
> switch branch1 branch2', what does each one mean?).

That's fair! The *only* form with 2 arguments is "switch
-c|--create|-C|--force-create", though, and the created branch always
comes after the "create" option.

I'm ok with not using this form here, even if I find it convenient.
Might be something we want to justify in the log message, which I
realize is already long ':D Then if a future editor wants to use
shorthands, at least there's something for them to find to consider
why it is this way now.

> > (One reason I point it out is that I'm a personal fan of the ways Git helps me
> > type *less*, and I think the "multiple commands to achieve one logical thing"
> > contributes to the scary/complex reputation---OTOH, avoiding upstream stuff here
> > seems like the right way to go.)
>
> I'm not sure if "multiple commands to achieve one logical thing"
> contributes to Git's scary/complex reputation. That could be true! It's
> not something I've ever considered as a factor.

Yeah, I dunno---it's speculation on my part. Maybe more precisely I
think it contributes to folks thinking of Git as "hard" (which it
certainly can be): they have to remember multiple commands to achieve
a single task, which we know from cognitive research adds additional
cognitive load. That load can either push other things out of our
brains or cause us to forget a step when we try to hold on to the
stuff we don't want to lose!

I suppose I'm a bit of an oddball though, in that I almost never do
anything other than

    git switch -c <new-branch> origin

to create a new branch, though.

Anyway, if you decide not to change that, I'm personally happy with
this version (and you/Junio can add my Reviewed-by, if you like).

-- 
D. Ben Knoble
Technical Details
Message-ID: <CALnO6CBkG+jo8ZoQktD4JSLGb_CDYOHA37XXMQ8YzhKrFypZnQ@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-76711-linux-kernel-git=dewy.ru
References: <pull.2307.git.1794259990263.gitgitgadget@gmail.com> <pull.2307.v2.git.1795554788715.gitgitgadget@gmail.com> <CALnO6CC-yRZ8W6MN7=X=nrP=TDObpY4a31o1jr-g3byfsC1UOg@mail.gmail.com> <2c10bb0a-911e-43e7-a889-227eb28c1a03@jvns.ca>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-76711-linux-kernel-git=dewy.ru
From: ben.knoble@gmail.com ("D. Ben Knoble")
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v2] doc: add tutorial on branches for beginners
Date: Mon, 30 Nov 2026 12:00:14 -0500
Organization: Usenet Network
Message-ID: <CALnO6CBkG+jo8ZoQktD4JSLGb_CDYOHA37XXMQ8YzhKrFypZnQ@mail.gmail.com>
References: <pull.2307.git.1794259990263.gitgitgadget@gmail.com>
 <pull.2307.v2.git.1795554788715.gitgitgadget@gmail.com> <CALnO6CC-yRZ8W6MN7=X=nrP=TDObpY4a31o1jr-g3byfsC1UOg@mail.gmail.com>
 <2c10bb0a-911e-43e7-a889-227eb28c1a03@jvns.ca>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1476720"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:K0uCgfNcyN+J81rjKCWkQeiQ+ko= sha256:NRLJDNd6JEETObN9K3QOLOnsDzCbv/WZnfe9uidhNIY=
	sha1:xqOURSG5CrExHy7Qe9bjDcH0lZM= sha256:zP+kZ9Ew2qWiFxpo3O+Xa+ZESwKVPfcIfx2R5PnxN9M=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id C869A125FF7; Mon, 30 Nov 2026 20:00:41 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id oNGoQqVsQMjB;
	Mon, 30 Nov 2026 20:00:38 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76711-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 5C836125FF6; Mon, 30 Nov 2026 20:00:30 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id CB9FD2ACAC; Mon, 30 Nov 2026 17:00:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796058028;
	b=v1Sr4W72Q1X1fiV1t85kF2KIKDHmO/Ga+5a3XA6v/6QicA54ZDYy3aYQA4PGFQserI+T
	 uzsly7FZAKFf50gW4w5N3CPPTdpqhaPCSwywTpKign80pVEwvPG0XCKQSsX6cErkLDKAe
	 wTtts6q5l03w7H/azUxuiXd0a+2j+SouZYK+A/9vgqFur5BfTtC5o+WdRUdvgeoA/sUz/
	 bvPE+eu3o0mTLUj0WZ6Bg+nvrHSVrMZk9rZTL3JEfk+UKmraxaRZj2hm3vsDJ/npPK00A
	 pyan8zv1FTer+5RYwH29emm1QL1k3Bzc8HfAfwrNhzi7mv43f58Emg/b1YlRr8h0FYw==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796058028;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 References:In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:
	 Cc:Content-Type:Content-Transfer-Encoding;
	bh=2Q3LUNwC7tAMaYOukE1KaLoRA7IvHJYTKZV928gEMUc=;
	b=d6wa7ft5nDkpNSe8GkWHr6FGOtzMiAuCxjr1FR6bp9I/Y3RjbFxWh1ORw4yYxHPwEpcX
	 PM7TDqoY7PbXNNGc8/BBHpa21UunfTpdZRXi50kXLTPIZLzigf1cDvp5tIX2OR3HcxTFk
	 49Uhci38Jn1y+9m+FvZylV7Ad5sdXWfa+cT/POP6Q2ljjTH8XxNyXDhAXugWiBmUkWWqv
	 VsOXH3Qojr7PLT/2thQQ5aN+iiRUxFS5sRyL0JUHYq76CSqk65AUiQwRzKXoXiXF04kWz
	 2M0QryYmN5YVHrnhF3IW3hmlHqzMVoRNK4BhsmWAhejSFUTVL9qGdtBzI+R/B/0vCEA==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=aJA5mJnM;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EAEC606A32C;
	Mon, 30 Nov 2026 17:00:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=aJA5mJnM
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.216.50
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796058027;
	b=oD1rjamq9Rhfj+AxyKkECo/NRt1hmoKzE6ubaEKor3NPvkHQXEOzBq2NEzompeUphBMZ
	 nPnz68kATtkSoaMfjsOtBz7dGDY+CKs4pfj/HcX3xBvIQtZDyZBhb+MPtbGvlBEZcrWCs
	 mzpjW3BSSbhUIqPGhFKRuYE2f9yotRZyYiiKLTfa0y80jkdJCeaYAdTPJq3qlougPo2GU
	 v3aC4g0q37gtz3G7SvtuRGvPvkCM8Vt9wacnpc/FnEkx6Aid5ASHHo4xtAjP2sF4t3T4Y
	 cGdx6GbeD8fIZeQoyLo+bTjlab0ComMjiUCvjh7QvGmgTBOr1dm9TPqSMuDXN7vtOXQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796058027;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 MIME-Version:References:In-Reply-To:From:Date:X-Gm-Features:
	 Message-ID:Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=2Q3LUNwC7tAMaYOukE1KaLoRA7IvHJYTKZV928gEMUc=;
	b=rIKOqrW1fm+X8kbL1wvy2tX9VpmWk4MY4T3YXiKlRH+UN7T6GQeLT7UTzoWg27tQi/XJ
	 L+L6ScIVcrfx6mZ7l67S9GmSI7SyL9HqZLmFpyD3TF2MRhQkEMAvuh9HZrPny+6/56s9j
	 4DhSXidtUvmTOXOvn10k16Bstlqv1beQfOvnF2hphD71dmXEf13iBbIh/Yf2Gh4mLlPpe
	 aSsKtyQ98C/Q2gjxU+ZwFSYNVcpCiz/9yoAYkPd7X9+6OkTrcfbiZdkL8DsxV/6ZCF+pM
	 FAtW74OZZQePj7YaxSARlw8V9YhEczhfbNWjAimPe3NjGOFZ88OkjUsRdw9o6B6txwQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=aJA5mJnM;
	arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.216.50
X-Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDE1C606A31C
	for <git@vger.kernel.org>; Mon, 30 Nov 2026 17:00:26 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CDE1C606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-3b421e8d111so6901080a91.3
        for <git@vger.kernel.org>; Mon, 30 Nov 2026 09:00:26 -0800 (PST)
X-ARC-Seal: i=1; a=rsa-sha256; t=1796058026; cv=none;
        d=google.com; s=arc-20260327;
        b=dGZK01UJN/3l6TXP2Emhq8C6c4qmZYJVqvUvfXjrMVER0dYzmd7MIMEIIqFpyarX1u
         HCbXDlvUufegmFvSp5VNVNRHxidMEIOpOnnYjwaZW1lHpVtva37Pqsp1Jc1F1qZRBVde
         CB/KfPvssmskmMKyT5uyeQhZzP1JSGDlv+wnDSPVLqHNnnHwb9OAtvVz8G9uLxlLZIlM
         073m3ZtfOSjrRqEVsEAEjIK2hx0Sl41UfeUf1efwcmc0AQfbLlUVSxK/FYuKn4J27zmC
         CGTTz4EXpgg6Qkr2vQkFFGe0Z8m7os0FmpdZIf9tbothvSj2D+2tlqc4wQHJjYw6+hiE
         ZjHA==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version:dkim-signature;
        bh=2Q3LUNwC7tAMaYOukE1KaLoRA7IvHJYTKZV928gEMUc=;
        fh=NezxN2nhftbJpkPz6D5mVkjc89BzOEp2d0Et/uzxGc8=;
        b=ZD0cc+LDPcQ/GuZ5FpxZHQGhNcNl3r5n2buzOZOB+WLyRpZX8q2LG0KVn8YKTJkVrw
         LUycpy5ZJ3QKSwjSvVOJ295HAZr13tjR2VYt//YaZEuP0tDf1nKGFfFOJGjkRQ+zS3fL
         H8sBrYxK3QL/jaWhhB18KH+wLAO9jnSVFtzFLYHK+6bSmiZ5CgWT8tqh1oOZwn0iKxId
         sl9a4/SAoPc9qW7kuHHxgN1AjnK/ytVyb+tKyjRK36bCFJ+H/ywxfc+YT1o5BR/vTwU2
         nsDl31AEflRVXnxNBrj2zHQhjE3ydgKCdja1A74/15qOP3GBLLavdSJWdpiJ/HrMGAIf
         BYtg==;
        darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796058026; x=1796662826; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=2Q3LUNwC7tAMaYOukE1KaLoRA7IvHJYTKZV928gEMUc=;
        b=aJA5mJnMu4t3ts8Mz1LnMWgata6CWaXWigCvNSRb07FpAkXFHYlOXCPoseMRvIqGpc
         4GSDp7PEjHdUJeil/SauYtl85r4sFo/rTc1cwMFk+Pp0lyljXoiu9vju0m+eUi0iY+6d
         IaSXaQ4cLQuhBvd31OkL22B0Zq61b0LijdizlKVOwFuKoIscnIzbHXogEDe05ZJ8aHuh
         I32huSu4NnHHBJ4rjcNQm3nyOM1dC+lpb39SD652orGVkeQkjHzPg1712vXe5woUnXDI
         PVI0KMyWvNoAxmxmatIEwXpPtw9AOtj3543NfFEgF3fzgbelS8UxLPoILyva39RfxZwn
         eiuQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796058026; x=1796662826;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=2Q3LUNwC7tAMaYOukE1KaLoRA7IvHJYTKZV928gEMUc=;
        b=ANXIiTSOTPywSxt8oneqVCqghiJLZ0CZ079xEiBVgRxasKR81fmqls19hcq29TDs26
         HylAtq21u8jsoRpe9FEz93NTnRRenyUz9+Oi+3YYevYyGSIuf2+kQ/Eayhy5y9ki6tni
         hG6jaLG/TcgynhAQ34fk/hQ26DUtLqQEb6yRvx3TQNsB/YLxkFs8Z3M8dFWsj8wx+xw4
         h/yTuzKB4B1sx7mdDHEQ6ePbV5/Qge/iiA16BGz7XCnJgN6I8FEAZVAomqN11J7cuoDJ
         CwGa+HijXbut02XANbiSqNBx88iaL1YGoW2tIrcIKMl9pgx986VKbKBbymYBiUBUoW0i
         CILg==
X-Forwarded-Encrypted: i=1; AL+hErFlH3j7G5KttpRzOOmLQWWlKph6s3g4qvqZ8inIcD0Oksu6oadEsq36fVwwn6wsyXId4XQ=@vger.kernel.org
X-Gm-Message-State: APuU4Z8yWbSlNDDcgUqjIY9f70t4mEPoXC4dfyAJDYO8XCkrR3sCvQTB
	lqWcFrQCAUnVqkEkPDvQQ7PA5pGdb7vuoMYTOMn1bOJdvN0wPuijZOC2EowZkW7QrrMCntYUvpr
	61GUF40vOE4tD1lsX/ncY+D2xvnoxU0s=
X-Gm-Gg: AZFdTZeb2MePOatkKq60SQkoeIZO9aRWMAG5EbY+Xx1WhPOnBtftu8a3kBpgsDP1Ok/
	lvVvwEnA4F8OxU4elyYH0ZMjX/Jk9ofCGVs7A49ct7GOECgMmWZcCEswRvyrN2E7jgK3aPpTKi6
	8CgFXzaYbFH9vPiRyDIg5EjgMNfQmsHVy/Z6R+74WK6T3ALpUM9Yx/2YKivDvko2XhYlgqlkeyx
	P8sMTUcCvb1EZYQpdT5sxgkEZOcj6TwnIMJh+eypX/M6C59s3bBP8fnd9zKA0qM1V5KAybjG0x4
	HfzZ0CDhtwk8wBWiOntUxuSEwPn/Ho2aHI1rOeUAa/nYoUWp6Gt2MIy2LNoh2hdMiQhntV78lbS
	iPwxL04Q9mGtqFVqCnXpc0o5k1uKbVDmgcdXwgLwclllrGOLj5sCc54JK3u/OKOmMgKPBe6UcbA
	/iLq6tdWGhE7qSk2AXeHKnTvtNpqUb3OHyrXX5KUPx2hPe0+UFITS9DrvdNXsTc01oqmE9ODGxn
	NpO1QI1NzW+oQ==
X-Received: by 2002:a17:90b:388c:b0:3b0:a378:1cf with SMTP id
 98e67ed59e1d1-3b41c9b2d39mr35026631a91.22.1796058025946; Mon, 30 Nov 2026
 09:00:25 -0800 (PST)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <2c10bb0a-911e-43e7-a889-227eb28c1a03@jvns.ca>
X-Gm-Features: Aa3M54qtiVw32Iw5NwXClFVl3Of3k7acaWSawiORqiBzV0WRuY5rEFN9_Urom38
X-Cc: Julia Evans via GitGitGadget <gitgitgadget@gmail.com>, git@vger.kernel.org, 
	Patrick Steinhardt <ps@pks.im>