Skip to contentSkip to conversation

docs: submitting-patches: use git switch to create branches

PATCH In review Weijie Yuan 3 participants 4 messages Sep 26 – Nov 4

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: submitting-patches: use git switch to create branches

From: Weijie Yuan <[email protected]>

Git has been promoting "git switch" since git.git commit 328c6cb853d7 (doc: promote "git switch"), and the command is no longer experimental as of Git 2.51.0.

---
 Documentation/process/submitting-patches.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/process/submitting-patches.rst +2 -2
index 4c28a239e8cb..63a5550bd490 100644
@@ -866,7 +866,7 @@ automatically include the base tree information in your submission by
 using the ``--base`` flag. The easiest and most convenient way to use
 this option is with topical branches::
 
-    $ git checkout -t -b my-topical-branch master
+    $ git switch -t -c my-topical-branch master
     Branch 'my-topical-branch' set up to track local branch 'master'.
     Switched to a new branch 'my-topical-branch'
 
@@ -882,7 +882,7 @@ notice that it will have the ``base-commit:`` trailer at the very
 bottom, which provides the reviewer and the CI tools enough information
 to properly perform ``git am`` without worrying about conflicts::
 
-    $ git checkout -b patch-review [base-commit-id]
+    $ git switch -c patch-review [base-commit-id]
     Switched to a new branch 'patch-review'
     $ git am patches.mbox
     Applying: First Commit
Signature · 1 line
2.55.0.1055.g20c0e7c0fb.dirty
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Weijie Yuan

\$ git checkout -t -b my-topical-branch master

Documentation/process/submitting-patches.rst +1 -0
+    \$ git switch -t -c my-topical-branch master
     Branch 'my-topical-branch' set up to track local branch 'master'.
     Switched to a new branch 'my-topical-branch'

Documentation/process/submitting-patches.rst notice that it will have the ``base-commit:`` trailer at the very · line 888

Quoted 8 lines
Documentation/process/submitting-patches.rst +1 -1
@@ -882,7 +882,7 @@ notice that it will have the ``base-commit:`` trailer at the very
 bottom, which provides the reviewer and the CI tools enough information
 to properly perform ``git am`` without worrying about conflicts::
 
-    \$ git checkout -b patch-review [base-commit-id]
+    \$ git switch -c patch-review [base-commit-id]
     Switched to a new branch 'patch-review'
     \$ git am patches.mbox
     Applying: First Commit

Hi Weijie,

Thank you for putting this patch together and for the credit. The conversion to the modern command layout keeps the guide fully up to date with current Git usage practices.

#2 lore raw

Hi Nguyen,

Quoted 18 lines · Nguyen Duc Thinh
Quoted 6 lines · Weijie Yuan

\$ git checkout -t -b my-topical-branch master

Documentation/process/submitting-patches.rst +1 -0
+    \$ git switch -t -c my-topical-branch master
     Branch 'my-topical-branch' set up to track local branch 'master'.
     Switched to a new branch 'my-topical-branch'

Documentation/process/submitting-patches.rst notice that it will have the ``base-commit:`` trailer at the very · line 888

Quoted 8 lines
Documentation/process/submitting-patches.rst +1 -1
@@ -882,7 +882,7 @@ notice that it will have the ``base-commit:`` trailer at the very
 bottom, which provides the reviewer and the CI tools enough information
 to properly perform ``git am`` without worrying about conflicts::
 
-    \$ git checkout -b patch-review [base-commit-id]
+    \$ git switch -c patch-review [base-commit-id]
     Switched to a new branch 'patch-review'
     \$ git am patches.mbox
     Applying: First Commit

Hi Weijie,

Quoted 5 lines

Thank you for putting this patch together and for the credit. The conversion to the modern command layout keeps the guide fully up to date with current Git usage practices.

Thanks for your review!

So sorry for forgetting to have you cc'ed on this patch, I wasn't using git-send-email so it didn't automatically add your addresses from the trailers.

And yes, I dived for some time and noticed that you haven't split this part yet and sent it out. To prevent forgetting later, I decided to do so. ;-)

Thanks.

#3 lore raw
In reply to Weijie Yuan
Quoted 36 lines · Weijie Yuan

From: Weijie Yuan <[email protected]>

Git has been promoting "git switch" since git.git commit 328c6cb853d7 (doc: promote "git switch"), and the command is no longer experimental as of Git 2.51.0.

---
 Documentation/process/submitting-patches.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/process/submitting-patches.rst +2 -2
index 4c28a239e8cb..63a5550bd490 100644
@@ -866,7 +866,7 @@ automatically include the base tree information in your submission by
 using the ``--base`` flag. The easiest and most convenient way to use
 this option is with topical branches::
 
-    $ git checkout -t -b my-topical-branch master
+    $ git switch -t -c my-topical-branch master
     Branch 'my-topical-branch' set up to track local branch 'master'.
     Switched to a new branch 'my-topical-branch'
 
@@ -882,7 +882,7 @@ notice that it will have the ``base-commit:`` trailer at the very
 bottom, which provides the reviewer and the CI tools enough information
 to properly perform ``git am`` without worrying about conflicts::
 
-    $ git checkout -b patch-review [base-commit-id]
+    $ git switch -c patch-review [base-commit-id]
     Switched to a new branch 'patch-review'
     $ git am patches.mbox
     Applying: First Commit
Signature · 1 line
2.55.0.1055.g20c0e7c0fb.dirty

Junio's <[email protected]> reminds me of this patch. It seems to have got lost in the flood of patches. Any feedback would be much appreciated, while this is only a minor cleanup. :-)

Thanks.