You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Git 2.23 comes with the experimental command `git switch`.
This commit adds a note with the most common operations that readers will want to use `git switch` for.
Copy file name to clipboardExpand all lines: book/03-git-branching/sections/nutshell.asc
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -198,3 +198,12 @@ Let's see why you should do so.
198
198
====
199
199
It's typical to create a new branch and want to switch to that new branch at the same time -- this can be done in one operation with `git checkout -b <newbranchname>`.
200
200
====
201
+
202
+
[NOTE]
203
+
====
204
+
From Git version 2.23 onwards you can use `git switch` instead of `git checkout` to:
205
+
206
+
- Switch to an existing branch: `git switch testing-branch`.
207
+
- Create a new branch and switch to it: `git switch -c new-branch`. The `-c` flag stands for create, you can also use the full flag: `--create`.
208
+
- Return to your previously checked out branch: `git switch -`.
0 commit comments