Skip to contentSkip to conversation

branch doc: consistently promote 'switch'

PATCH In review Junio C Hamano 2 participants 2 messages Nov 3 – Nov 4 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 branch doc: consistently promote 'switch'

When 328c6cb853 (doc: promote "git switch", 2019-03-29) updated an example in git-branch documentation, it made an inconsistent change to turn "git checkout my2.6.14" command in an example into "git switch my2.6.14", without updating a comment that talks about a shorthand to create and checkout the newly created branch at the same time, which still talked about "checkout -b <new> <start>".

Update the latter to talk about "git switch -c" for consistency.

---

* An alternative would be to list both "git checkout -b" and "git switch -c", as "git checkout" is not going away (for the purpose of *replacing* checkout, the switch/restore were a failed experiment, even though they gained enough users to stay).

 Documentation/git-branch.adoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/git-branch.adoc +1 -1
index bfdf459329..a803c24858 100644
@@ -406,17 +406,17 @@ Start development from a known tag::
 ------------
 $ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
 $ cd my2.6
 $ git branch my2.6.14 v2.6.14   <1>
 $ git switch my2.6.14
 ------------
 +
 <1> This step and the next one could be combined into a single step with
-    "checkout -b my2.6.14 v2.6.14".
+    "git switch -c my2.6.14 v2.6.14".
 
 Delete an unneeded branch::
 +
 ------------
 $ git clone git://git.kernel.org/.../git.git my.git
 $ cd my.git
 $ git branch -d -r origin/todo origin/html origin/man   <1>
 $ git branch -D test                                    <2>
#1 lore raw
Quoted 39 lines · Junio C Hamano

When 328c6cb853 (doc: promote "git switch", 2019-03-29) updated an example in git-branch documentation, it made an inconsistent change to turn "git checkout my2.6.14" command in an example into "git switch my2.6.14", without updating a comment that talks about a shorthand to create and checkout the newly created branch at the same time, which still talked about "checkout -b <new> <start>".

Update the latter to talk about "git switch -c" for consistency.

---

* An alternative would be to list both "git checkout -b" and "git switch -c", as "git checkout" is not going away (for the purpose of *replacing* checkout, the switch/restore were a failed experiment, even though they gained enough users to stay).

Documentation/git-branch.adoc | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/git-branch.adoc +0 -1
index bfdf459329..a803c24858 100644
@@ -406,17 +406,17 @@ Start development from a known tag::
------------
$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
$ cd my2.6
$ git branch my2.6.14 v2.6.14   <1>
$ git switch my2.6.14
------------
+
<1> This step and the next one could be combined into a single step with
Documentation/git-branch.adoc +1 -1
-    "checkout -b my2.6.14 v2.6.14".
+    "git switch -c my2.6.14 v2.6.14".
Quoted 7 lines

Delete an unneeded branch::
+
------------

$ git clone git://git.kernel.org/.../git.git my.git
$ cd my.git
$ git branch -d -r origin/todo origin/html origin/man   <1>
$ git branch -D test                                    <2>

All sensible to me.

FWIW, the more folks I teach about switch the more folks tell me they have, ahem, switched. And prefer it!