{"thread":{"id":"61291","subject":"[PATCH] MyFirstContribution: use switch for changing branches","startedAt":"2024-04-07T21:21:17Z","lastAt":"2024-04-09T16:36:42Z","messageCount":6,"participants":["Benji Fisher","Junio C Hamano","Kipras Melnikovas","Emily Shaffer"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"492477","messageId":"20240407212109.35131-1-benji@FisherFam.org","threadId":"61291","inReplyTo":null,"subject":"[PATCH] MyFirstContribution: use switch for changing branches","fromName":"Benji Fisher","fromEmail":"benji@fisherfam.org","sentAt":"2024-04-07T21:21:09Z","receivedAt":"2024-04-07T21:21:17Z","isPatch":true,"sender":{"key":"benji@fisherfam.org","avatar":null},"body":"Use \"git switch\" instead of \"git checkout\" for changing branches.\n\nSigned-off-by: Benji Fisher <benji@FisherFam.org>\n---\n Documentation/MyFirstContribution.txt | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/MyFirstContribution.txt b/Documentation/MyFirstContribution.txt\nindex f06563e981..66f38a7055 100644\n--- a/Documentation/MyFirstContribution.txt\n+++ b/Documentation/MyFirstContribution.txt\n@@ -122,7 +122,7 @@ branch of the upstream project. Create the `psuh` branch you will use for\n development like so:\n \n ----\n-$ git checkout -b psuh origin/master\n+$ git switch -c psuh origin/master\n ----\n \n We'll make a number of commits here in order to demonstrate how to send a topic\n@@ -878,7 +878,7 @@ on `master`, so go ahead and update as shown below, or using your preferred\n workflow.\n \n ----\n-$ git checkout master\n+$ git switch master\n $ git pull -r\n $ git rebase master psuh\n ----\n@@ -1139,7 +1139,7 @@ We'll reuse our `psuh` topic branch for v2. Before we make any changes, we'll\n mark the tip of our v1 branch for easy reference:\n \n ----\n-$ git checkout psuh\n+$ git switch psuh\n $ git branch psuh-v1\n ----\n \n-- \n2.40.1\n\n"},{"id":"492574","messageId":"xmqqr0ffbvjq.fsf@gitster.g","threadId":"61291","inReplyTo":"20240407212109.35131-1-benji@FisherFam.org","subject":"Re: [PATCH] MyFirstContribution: use switch for changing branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-04-08T17:42:33Z","receivedAt":"2024-04-08T17:42:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Benji Fisher <benji@FisherFam.org> writes:\n\n> Use \"git switch\" instead of \"git checkout\" for changing branches.\n\n... because?\n\nIn the proposed log message, make sure you are telling the readers\nWHY the change was needed and desirable.\n\nThe usual way to compose a log message for this project is to\n\n - Give an observation on how the current system work in the present\n   tense (so no need to say \"Currently X is Y\", just \"X is Y\"), and\n   discuss what you perceive as a problem in it.\n\n - Propose a solution (optional---often, problem description\n   trivially leads to an obvious solution in reader's minds).\n\n - Give commands to the codebase to \"become like so\".\n\nin this order.\n\nFor this particular patch, I do not see a compelling reason why we\nshould make these changes.  It is not like MyFirst* documents\nconsistently uses \"git switch\" (and \"git restore\") in other places\nand these three are the exceptions (in which case that would be a\nvery good justification you would describe in the \"observation\"\nparagraph of your proposed log message).  We are not deprecating\n\"git checkout\", either.\n\nThanks.\n"},{"id":"492632","messageId":"CANc=FSNXzsFqzbgGs3CVAPxtxske_DEorNrk66gvYe2+1d_PAQ@mail.gmail.com","threadId":"61291","inReplyTo":"xmqqr0ffbvjq.fsf@gitster.g","subject":"Re: [PATCH] MyFirstContribution: use switch for changing branches","fromName":"Benji Fisher","fromEmail":"benji@fisherfam.org","sentAt":"2024-04-09T12:26:58Z","receivedAt":"2024-04-09T12:27:11Z","isPatch":true,"sender":{"key":"benji@fisherfam.org","avatar":null},"body":"On Mon, Apr 8, 2024 at 1:42 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> For this particular patch, I do not see a compelling reason why we\n> should make these changes.  It is not like MyFirst* documents\n> consistently uses \"git switch\" (and \"git restore\") in other places\n> and these three are the exceptions (in which case that would be a\n> very good justification you would describe in the \"observation\"\n> paragraph of your proposed log message).  We are not deprecating\n> \"git checkout\", either.\n\nI was under the impression that the new \"git switch\" and \"git restore\"\ncommands were recommended in most cases instead of \"git checkout\". If\nnot, then I withdraw my suggestion. I apologize for making noise on\nthis list.\n\nThanks for considering my patch. Thanks even more for maintaining git.\n\n-- \nBenji Fisher\n"},{"id":"492633","messageId":"20240409134721.5106-2-kipras@kipras.org","threadId":"61291","inReplyTo":"CANc=FSNXzsFqzbgGs3CVAPxtxske_DEorNrk66gvYe2+1d_PAQ@mail.gmail.com","subject":"","fromName":"Kipras Melnikovas","fromEmail":"kipras@kipras.org","sentAt":"2024-04-09T13:47:22Z","receivedAt":"2024-04-09T14:14:58Z","isPatch":false,"sender":{"key":"kipras@kipras.org","avatar":"https://avatars.githubusercontent.com/u/29430509?v=4"},"body":"> I was under the impression that the new \"git switch\" and \"git restore\"\n> commands were recommended in most cases instead of \"git checkout\".\n\nFor new users, yes.\nFor someone who's looking to contribute to core git - probably not.\n\n"},{"id":"492640","messageId":"xmqqwmp61poj.fsf@gitster.g","threadId":"61291","inReplyTo":"CANc=FSNXzsFqzbgGs3CVAPxtxske_DEorNrk66gvYe2+1d_PAQ@mail.gmail.com","subject":"Re: [PATCH] MyFirstContribution: use switch for changing branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-04-09T16:11:40Z","receivedAt":"2024-04-09T16:11:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Benji Fisher <benji@fisherfam.org> writes:\n\n> I was under the impression that the new \"git switch\" and \"git restore\"\n> commands were recommended in most cases instead of \"git checkout\".\n\nThese two were added so that eventually we have something we can\nrecommend to new users, but as a pair of experimental commands, we\nreserve the rights to update their UI in backward incompatible ways\n(meaning: those who use them may need to retrain their fingers and\nupdate their scripts if they used them---not that using these\nPorcelain commands in scripts is a good idea to begin with).\n\nSo your justification could be\n\n    We want to evantually be able to recommend restore/switch to new\n    users, and want to take advantage of every opportunity to polish\n    them.\n\n    Because this document is not exactly for totally new users, and\n    the readers are expected to be knowledgeable enough and highly\n    motivated in improving git, let's have them use these\n    experimental commands and report newbie-issues they found using\n    them, so that we can gain more experience and chances to polish\n    the command and eventually make them recommendable to new users.\n\nNote that the \"WHY?\" in my response was not \"I see no reason to do\nthis\", but \"You need to say why you think this is a good idea here\nin the proposed commit log message\".  Without your version of\nreasoning, my conclusion was \"I do not see a point\", but with a\njustification like this (there could be others---it is contributor's\njob to explain why a proposed change is a good idea, not mine), I\ncan understand the reasoning why this change may be a good one.\n\nThanks.\n"},{"id":"492642","messageId":"CAJoAoZmBvkVzP2i=BEgZ9fEcQFHtPkh4pPHm4hj_U5AUqKQFFw@mail.gmail.com","threadId":"61291","inReplyTo":"xmqqwmp61poj.fsf@gitster.g","subject":"Re: [PATCH] MyFirstContribution: use switch for changing branches","fromName":"Emily Shaffer","fromEmail":"nasamuffin@google.com","sentAt":"2024-04-09T16:36:27Z","receivedAt":"2024-04-09T16:36:42Z","isPatch":true,"sender":{"key":"nasamuffin@google.com","avatar":"https://avatars.githubusercontent.com/u/1606826?v=4"},"body":"On Tue, Apr 9, 2024 at 9:11 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Benji Fisher <benji@fisherfam.org> writes:\n>\n> > I was under the impression that the new \"git switch\" and \"git restore\"\n> > commands were recommended in most cases instead of \"git checkout\".\n>\n> These two were added so that eventually we have something we can\n> recommend to new users, but as a pair of experimental commands, we\n> reserve the rights to update their UI in backward incompatible ways\n> (meaning: those who use them may need to retrain their fingers and\n> update their scripts if they used them---not that using these\n> Porcelain commands in scripts is a good idea to begin with).\n>\n> So your justification could be\n>\n>     We want to evantually be able to recommend restore/switch to new\n>     users, and want to take advantage of every opportunity to polish\n>     them.\n>\n>     Because this document is not exactly for totally new users, and\n>     the readers are expected to be knowledgeable enough and highly\n>     motivated in improving git, let's have them use these\n>     experimental commands and report newbie-issues they found using\n>     them, so that we can gain more experience and chances to polish\n>     the command and eventually make them recommendable to new users.\n>\n> Note that the \"WHY?\" in my response was not \"I see no reason to do\n> this\", but \"You need to say why you think this is a good idea here\n> in the proposed commit log message\".  Without your version of\n> reasoning, my conclusion was \"I do not see a point\", but with a\n> justification like this (there could be others---it is contributor's\n> job to explain why a proposed change is a good idea, not mine), I\n> can understand the reasoning why this change may be a good one.\n\nFor what it's worth, when I wrote this doc I was new enough to hacking\nGit that I did not know about the new experimental commands ;) or else\nI would have used them. I am not opposed to pointing them out in this\ndoc as part of general evangelism towards a nice UX improvement (and\nthat could be good justification for the commit message, if you agree,\nBenji).\n\n - Emily\n"}]}