git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MyFirstContribution: use switch for changing branches
@ 2024-04-07 21:21 Benji Fisher
  2024-04-08 17:42 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Benji Fisher @ 2024-04-07 21:21 UTC (permalink / raw)
  To: git, nasamuffin; +Cc: Benji Fisher

Use "git switch" instead of "git checkout" for changing branches.

Signed-off-by: Benji Fisher <benji@FisherFam.org>
---
 Documentation/MyFirstContribution.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/MyFirstContribution.txt b/Documentation/MyFirstContribution.txt
index f06563e981..66f38a7055 100644
--- a/Documentation/MyFirstContribution.txt
+++ b/Documentation/MyFirstContribution.txt
@@ -122,7 +122,7 @@ branch of the upstream project. Create the `psuh` branch you will use for
 development like so:
 
 ----
-$ git checkout -b psuh origin/master
+$ git switch -c psuh origin/master
 ----
 
 We'll make a number of commits here in order to demonstrate how to send a topic
@@ -878,7 +878,7 @@ on `master`, so go ahead and update as shown below, or using your preferred
 workflow.
 
 ----
-$ git checkout master
+$ git switch master
 $ git pull -r
 $ git rebase master psuh
 ----
@@ -1139,7 +1139,7 @@ We'll reuse our `psuh` topic branch for v2. Before we make any changes, we'll
 mark the tip of our v1 branch for easy reference:
 
 ----
-$ git checkout psuh
+$ git switch psuh
 $ git branch psuh-v1
 ----
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] MyFirstContribution: use switch for changing branches
  2024-04-07 21:21 [PATCH] MyFirstContribution: use switch for changing branches Benji Fisher
@ 2024-04-08 17:42 ` Junio C Hamano
  2024-04-09 12:26   ` Benji Fisher
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2024-04-08 17:42 UTC (permalink / raw)
  To: Benji Fisher; +Cc: git, nasamuffin

Benji Fisher <benji@FisherFam.org> writes:

> Use "git switch" instead of "git checkout" for changing branches.

... because?

In the proposed log message, make sure you are telling the readers
WHY the change was needed and desirable.

The usual way to compose a log message for this project is to

 - Give an observation on how the current system work in the present
   tense (so no need to say "Currently X is Y", just "X is Y"), and
   discuss what you perceive as a problem in it.

 - Propose a solution (optional---often, problem description
   trivially leads to an obvious solution in reader's minds).

 - Give commands to the codebase to "become like so".

in this order.

For this particular patch, I do not see a compelling reason why we
should make these changes.  It is not like MyFirst* documents
consistently uses "git switch" (and "git restore") in other places
and these three are the exceptions (in which case that would be a
very good justification you would describe in the "observation"
paragraph of your proposed log message).  We are not deprecating
"git checkout", either.

Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] MyFirstContribution: use switch for changing branches
  2024-04-08 17:42 ` Junio C Hamano
@ 2024-04-09 12:26   ` Benji Fisher
  2024-04-09 13:47     ` Kipras Melnikovas
  2024-04-09 16:11     ` [PATCH] MyFirstContribution: use switch for changing branches Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: Benji Fisher @ 2024-04-09 12:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, nasamuffin

On Mon, Apr 8, 2024 at 1:42 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> For this particular patch, I do not see a compelling reason why we
> should make these changes.  It is not like MyFirst* documents
> consistently uses "git switch" (and "git restore") in other places
> and these three are the exceptions (in which case that would be a
> very good justification you would describe in the "observation"
> paragraph of your proposed log message).  We are not deprecating
> "git checkout", either.

I was under the impression that the new "git switch" and "git restore"
commands were recommended in most cases instead of "git checkout". If
not, then I withdraw my suggestion. I apologize for making noise on
this list.

Thanks for considering my patch. Thanks even more for maintaining git.

-- 
Benji Fisher

^ permalink raw reply	[flat|nested] 6+ messages in thread

* (no subject)
  2024-04-09 12:26   ` Benji Fisher
@ 2024-04-09 13:47     ` Kipras Melnikovas
  2024-04-09 16:11     ` [PATCH] MyFirstContribution: use switch for changing branches Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Kipras Melnikovas @ 2024-04-09 13:47 UTC (permalink / raw)
  To: benji; +Cc: git, gitster, nasamuffin

> I was under the impression that the new "git switch" and "git restore"
> commands were recommended in most cases instead of "git checkout".

For new users, yes.
For someone who's looking to contribute to core git - probably not.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] MyFirstContribution: use switch for changing branches
  2024-04-09 12:26   ` Benji Fisher
  2024-04-09 13:47     ` Kipras Melnikovas
@ 2024-04-09 16:11     ` Junio C Hamano
  2024-04-09 16:36       ` Emily Shaffer
  1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2024-04-09 16:11 UTC (permalink / raw)
  To: Benji Fisher; +Cc: git, nasamuffin

Benji Fisher <benji@fisherfam.org> writes:

> I was under the impression that the new "git switch" and "git restore"
> commands were recommended in most cases instead of "git checkout".

These two were added so that eventually we have something we can
recommend to new users, but as a pair of experimental commands, we
reserve the rights to update their UI in backward incompatible ways
(meaning: those who use them may need to retrain their fingers and
update their scripts if they used them---not that using these
Porcelain commands in scripts is a good idea to begin with).

So your justification could be

    We want to evantually be able to recommend restore/switch to new
    users, and want to take advantage of every opportunity to polish
    them.

    Because this document is not exactly for totally new users, and
    the readers are expected to be knowledgeable enough and highly
    motivated in improving git, let's have them use these
    experimental commands and report newbie-issues they found using
    them, so that we can gain more experience and chances to polish
    the command and eventually make them recommendable to new users.

Note that the "WHY?" in my response was not "I see no reason to do
this", but "You need to say why you think this is a good idea here
in the proposed commit log message".  Without your version of
reasoning, my conclusion was "I do not see a point", but with a
justification like this (there could be others---it is contributor's
job to explain why a proposed change is a good idea, not mine), I
can understand the reasoning why this change may be a good one.

Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] MyFirstContribution: use switch for changing branches
  2024-04-09 16:11     ` [PATCH] MyFirstContribution: use switch for changing branches Junio C Hamano
@ 2024-04-09 16:36       ` Emily Shaffer
  0 siblings, 0 replies; 6+ messages in thread
From: Emily Shaffer @ 2024-04-09 16:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Benji Fisher, git

On Tue, Apr 9, 2024 at 9:11 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> Benji Fisher <benji@fisherfam.org> writes:
>
> > I was under the impression that the new "git switch" and "git restore"
> > commands were recommended in most cases instead of "git checkout".
>
> These two were added so that eventually we have something we can
> recommend to new users, but as a pair of experimental commands, we
> reserve the rights to update their UI in backward incompatible ways
> (meaning: those who use them may need to retrain their fingers and
> update their scripts if they used them---not that using these
> Porcelain commands in scripts is a good idea to begin with).
>
> So your justification could be
>
>     We want to evantually be able to recommend restore/switch to new
>     users, and want to take advantage of every opportunity to polish
>     them.
>
>     Because this document is not exactly for totally new users, and
>     the readers are expected to be knowledgeable enough and highly
>     motivated in improving git, let's have them use these
>     experimental commands and report newbie-issues they found using
>     them, so that we can gain more experience and chances to polish
>     the command and eventually make them recommendable to new users.
>
> Note that the "WHY?" in my response was not "I see no reason to do
> this", but "You need to say why you think this is a good idea here
> in the proposed commit log message".  Without your version of
> reasoning, my conclusion was "I do not see a point", but with a
> justification like this (there could be others---it is contributor's
> job to explain why a proposed change is a good idea, not mine), I
> can understand the reasoning why this change may be a good one.

For what it's worth, when I wrote this doc I was new enough to hacking
Git that I did not know about the new experimental commands ;) or else
I would have used them. I am not opposed to pointing them out in this
doc as part of general evangelism towards a nice UX improvement (and
that could be good justification for the commit message, if you agree,
Benji).

 - Emily

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-09 16:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-07 21:21 [PATCH] MyFirstContribution: use switch for changing branches Benji Fisher
2024-04-08 17:42 ` Junio C Hamano
2024-04-09 12:26   ` Benji Fisher
2024-04-09 13:47     ` Kipras Melnikovas
2024-04-09 16:11     ` [PATCH] MyFirstContribution: use switch for changing branches Junio C Hamano
2024-04-09 16:36       ` Emily Shaffer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).