doc: promote "git switch"
The new command "git switch" is added to avoid the confusion of one-command-do-all "git checkout" for new users. They are also helpful to avoid ambiguation context. For these reasons, promote it everywhere possible. This includes documentation, suggestions/advice from other commands... The "Checking out files" progress line in unpack-trees.c is also updated to "Updating files" to be neutral to both git-checkout and git-switch. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Mar 29, 2019 at 17:39 UTC
328c6cb853d7237098569de9f94bc3d259846a08
19 files changed
+105
-105
Documentation/git-branch.txt
+6
-6
@@ -48,7 +48,7 @@ The command's second form creates a new branch head named <branchname>
48
which points to the current `HEAD`, or <start-point> if given.
49
50
Note that this will create the new branch, but it will not switch the
51
-working tree to it; use "git checkout <newbranch>" to switch to the
51
+working tree to it; use "git switch <newbranch>" to switch to the
52
new branch.
53
54
When a local branch is started off a remote-tracking branch, Git sets up the
@@ -198,7 +198,7 @@ This option is only applicable in non-verbose mode.
198
+
199
This behavior is the default when the start point is a remote-tracking branch.
200
Set the branch.autoSetupMerge configuration variable to `false` if you
201
-want `git checkout` and `git branch` to always behave as if `--no-track`
201
+want `git switch`, `git checkout` and `git branch` to always behave as if `--no-track`
202
were given. Set it to `always` if you want this behavior when the
203
start-point is either a local or remote-tracking branch.
204
@@ -297,7 +297,7 @@ Start development from a known tag::
297
$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
298
$ cd my2.6
299
$ git branch my2.6.14 v2.6.14 <1>
300
-$ git checkout my2.6.14
300
+$ git switch my2.6.14
301
------------
302
+
303
<1> This step and the next one could be combined into a single step with
@@ -322,9 +322,9 @@ $ git branch -D test <2>
322
NOTES
323
-----
324
325
-If you are creating a branch that you want to checkout immediately, it is
326
-easier to use the git checkout command with its `-b` option to create
327
-a branch and check it out with a single command.
325
+If you are creating a branch that you want to switch to immediately,
326
+it is easier to use the "git switch" command with its `-c` option to
327
+do the same thing with a single command.
328
329
The options `--contains`, `--no-contains`, `--merged` and `--no-merged`
330
serve four related but different purposes:
Documentation/git-check-ref-format.txt
+2
-1
@@ -88,7 +88,8 @@ but it is explicitly forbidden at the beginning of a branch name).
88
When run with `--branch` option in a repository, the input is first
89
expanded for the ``previous checkout syntax''
90
`@{-n}`. For example, `@{-1}` is a way to refer the last thing that
91
-was checked out using "git checkout" operation. This option should be
91
+was checked out using "git switch" or "git checkout" operation.
92
+This option should be
93
used by porcelains to accept this syntax anywhere a branch name is
94
expected, so they can act as if you typed the branch name. As an
95
exception note that, the ``previous checkout operation'' might result
Documentation/git-format-patch.txt
+1
-1
@@ -421,7 +421,7 @@ One way to test if your MUA is set up correctly is:
421
* Apply it:
422
423
$ git fetch <project> master:test-apply
424
- $ git checkout test-apply
424
+ $ git switch test-apply
425
$ git reset --hard
426
$ git am a.patch
427
Documentation/git-merge-base.txt
+1
-1
@@ -149,7 +149,7 @@ instead.
149
Discussion on fork-point mode
150
-----------------------------
151
152
-After working on the `topic` branch created with `git checkout -b
152
+After working on the `topic` branch created with `git switch -c
153
topic origin/master`, the history of remote-tracking branch
154
`origin/master` may have been rewound and rebuilt, leading to a
155
history of this shape:
Documentation/git-rebase.txt
+1
-1
@@ -17,7 +17,7 @@ SYNOPSIS
17
DESCRIPTION
18
-----------
19
If <branch> is specified, 'git rebase' will perform an automatic
20
-`git checkout <branch>` before doing anything else. Otherwise
20
+`git switch <branch>` before doing anything else. Otherwise
21
it remains on the current branch.
22
23
If <upstream> is not specified, the upstream configured in
Documentation/git-remote.txt
+1
-1
@@ -230,7 +230,7 @@ $ git branch -r
230
staging/master
231
staging/staging-linus
232
staging/staging-next
233
-$ git checkout -b staging staging/master
233
+$ git switch -c staging staging/master
234
...
235
------------
236
Documentation/git-rerere.txt
+5
-5
@@ -91,7 +91,7 @@ For such a test, you need to merge master and topic somehow.
91
One way to do it is to pull master into the topic branch:
92
93
------------
94
- $ git checkout topic
94
+ $ git switch topic
95
$ git merge master
96
97
o---*---o---+ topic
@@ -113,10 +113,10 @@ the upstream might have been advanced since the test merge `+`,
113
in which case the final commit graph would look like this:
114
115
------------
116
- $ git checkout topic
116
+ $ git switch topic
117
$ git merge master
118
$ ... work on both topic and master branches
119
- $ git checkout master
119
+ $ git switch master
120
$ git merge topic
121
122
o---*---o---+---o---o topic
@@ -136,11 +136,11 @@ merges, you could blow away the test merge, and keep building on
136
top of the tip before the test merge:
137
138
------------
139
- $ git checkout topic
139
+ $ git switch topic
140
$ git merge master
141
$ git reset --hard HEAD^ ;# rewind the test merge
142
$ ... work on both topic and master branches
143
- $ git checkout master
143
+ $ git switch master
144
$ git merge topic
145
146
o---*---o-------o---o topic
Documentation/git-reset.txt
+10
-10
@@ -149,9 +149,9 @@ See also the `--amend` option to linkgit:git-commit[1].
149
Undo a commit, making it a topic branch::
150
+
151
------------
152
-$ git branch topic/wip <1>
153
-$ git reset --hard HEAD~3 <2>
154
-$ git checkout topic/wip <3>
152
+$ git branch topic/wip <1>
153
+$ git reset --hard HEAD~3 <2>
154
+$ git switch topic/wip <3>
155
------------
156
+
157
<1> You have made some commits, but realize they were premature
@@ -232,13 +232,13 @@ working tree are not in any shape to be committed yet, but you
232
need to get to the other branch for a quick bugfix.
233
+
234
------------
235
-$ git checkout feature ;# you were working in "feature" branch and
236
-$ work work work ;# got interrupted
235
+$ git switch feature ;# you were working in "feature" branch and
236
+$ work work work ;# got interrupted
237
$ git commit -a -m "snapshot WIP" <1>
238
-$ git checkout master
238
+$ git switch master
239
$ fix fix fix
240
$ git commit ;# commit with real log
241
-$ git checkout feature
241
+$ git switch feature
242
$ git reset --soft HEAD^ ;# go back to WIP state <2>
243
$ git reset <3>
244
------------
@@ -279,18 +279,18 @@ reset it while keeping the changes in your working tree.
279
+
280
------------
281
$ git tag start
282
-$ git checkout -b branch1
282
+$ git switch -c branch1
283
$ edit
284
$ git commit ... <1>
285
$ edit
286
-$ git checkout -b branch2 <2>
286
+$ git switch -c branch2 <2>
287
$ git reset --keep start <3>
288
------------
289
+
290
<1> This commits your first edits in `branch1`.
291
<2> In the ideal world, you could have realized that the earlier
292
commit did not belong to the new topic when you created and switched
293
- to `branch2` (i.e. `git checkout -b branch2 start`), but nobody is
293
+ to `branch2` (i.e. `git switch -c branch2 start`), but nobody is
294
perfect.
295
<3> But you can use `reset --keep` to remove the unwanted commit after
296
you switched to `branch2`.
Documentation/git-stash.txt
+5
-4
@@ -235,12 +235,12 @@ return to your original branch to make the emergency fix, like this:
235
+
236
----------------------------------------------------------------
237
# ... hack hack hack ...
238
-$ git checkout -b my_wip
238
+$ git switch -c my_wip
239
$ git commit -a -m "WIP"
240
-$ git checkout master
240
+$ git switch master
241
$ edit emergency fix
242
$ git commit -a -m "Fix in a hurry"
243
-$ git checkout my_wip
243
+$ git switch my_wip
244
$ git reset --soft HEAD^
245
# ... continue hacking ...
246
----------------------------------------------------------------
@@ -293,7 +293,8 @@ SEE ALSO
293
linkgit:git-checkout[1],
294
linkgit:git-commit[1],
295
linkgit:git-reflog[1],
296
-linkgit:git-reset[1]
296
+linkgit:git-reset[1],
297
+linkgit:git-switch[1]
298
299
GIT
300
---
Documentation/gitcore-tutorial.txt
+9
-10
@@ -741,7 +741,7 @@ used earlier, and create a branch in it. You do that by simply just
741
saying that you want to check out a new branch:
742
743
------------
744
-$ git checkout -b mybranch
744
+$ git switch -c mybranch
745
------------
746
747
will create a new branch based at the current `HEAD` position, and switch
@@ -755,7 +755,7 @@ just telling 'git checkout' what the base of the checkout would be.
755
In other words, if you have an earlier tag or branch, you'd just do
756
757
------------
758
-$ git checkout -b mybranch earlier-commit
758
+$ git switch -c mybranch earlier-commit
759
------------
760
761
and it would create the new branch `mybranch` at the earlier commit,
@@ -765,7 +765,7 @@ and check out the state at that time.
765
You can always just jump back to your original `master` branch by doing
766
767
------------
768
-$ git checkout master
768
+$ git switch master
769
------------
770
771
(or any other branch-name, for that matter) and if you forget which
@@ -794,7 +794,7 @@ $ git branch <branchname> [startingpoint]
794
795
which will simply _create_ the branch, but will not do anything further.
796
You can then later -- once you decide that you want to actually develop
797
-on that branch -- switch to that branch with a regular 'git checkout'
797
+on that branch -- switch to that branch with a regular 'git switch'
798
with the branchname as the argument.
799
800
@@ -808,7 +808,7 @@ being the same as the original `master` branch, let's make sure we're in
808
that branch, and do some work there.
809
810
------------------------------------------------
811
-$ git checkout mybranch
811
+$ git switch mybranch
812
$ echo "Work, work, work" >>hello
813
$ git commit -m "Some work." -i hello
814
------------------------------------------------
@@ -825,7 +825,7 @@ does some work in the original branch, and simulate that by going back
825
to the master branch, and editing the same file differently there:
826
827
------------
828
-$ git checkout master
828
+$ git switch master
829
------------
830
831
Here, take a moment to look at the contents of `hello`, and notice how they
@@ -958,7 +958,7 @@ to the `master` branch. Let's go back to `mybranch`, and run
958
'git merge' to get the "upstream changes" back to your branch.
959
960
------------
961
-$ git checkout mybranch
961
+$ git switch mybranch
962
$ git merge -m "Merge upstream changes." master
963
------------
964
@@ -1133,9 +1133,8 @@ Remember, before running 'git merge', our `master` head was at
1133
work." commit.
1134
1135
------------
1136
-$ git checkout mybranch
1137
-$ git reset --hard master^2
1138
-$ git checkout master
1136
+$ git switch -C mybranch master^2
1137
+$ git switch master
1138
$ git reset --hard master^
1139
------------
1140
Documentation/giteveryday.txt
+12
-12
@@ -41,7 +41,7 @@ following commands.
41
42
* linkgit:git-log[1] to see what happened.
43
44
- * linkgit:git-checkout[1] and linkgit:git-branch[1] to switch
44
+ * linkgit:git-switch[1] and linkgit:git-branch[1] to switch
45
branches.
46
47
* linkgit:git-add[1] to manage the index file.
@@ -80,7 +80,7 @@ $ git tag v2.43 <2>
80
Create a topic branch and develop.::
81
+
82
------------
83
-$ git checkout -b alsa-audio <1>
83
+$ git switch -c alsa-audio <1>
84
$ edit/compile/test
85
$ git checkout -- curses/ux_audio_oss.c <2>
86
$ git add curses/ux_audio_alsa.c <3>
@@ -90,7 +90,7 @@ $ git commit -a -s <5>
90
$ edit/compile/test
91
$ git diff HEAD^ <6>
92
$ git commit -a --amend <7>
93
-$ git checkout master <8>
93
+$ git switch master <8>
94
$ git merge alsa-audio <9>
95
$ git log --since='3 days ago' <10>
96
$ git log v2.43.. curses/ <11>
@@ -148,11 +148,11 @@ Clone the upstream and work on it. Feed changes to upstream.::
148
------------
149
$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6
150
$ cd my2.6
151
-$ git checkout -b mine master <1>
151
+$ git switch -c mine master <1>
152
$ edit/compile/test; git commit -a -s <2>
153
$ git format-patch master <3>
154
$ git send-email --to="person <email@example.com>" 00*.patch <4>
155
-$ git checkout master <5>
155
+$ git switch master <5>
156
$ git pull <6>
157
$ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <7>
158
$ git ls-remote --heads http://git.kernel.org/.../jgarzik/libata-dev.git <8>
@@ -194,7 +194,7 @@ satellite$ edit/compile/test/commit
194
satellite$ git push origin <4>
195
196
mothership$ cd frotz
197
-mothership$ git checkout master
197
+mothership$ git switch master
198
mothership$ git merge satellite/master <5>
199
------------
200
+
@@ -216,7 +216,7 @@ machine into the master branch.
216
Branch off of a specific tag.::
217
+
218
------------
219
-$ git checkout -b private2.6.14 v2.6.14 <1>
219
+$ git switch -c private2.6.14 v2.6.14 <1>
220
$ edit/compile/test; git commit -a
221
$ git checkout master
222
$ git cherry-pick v2.6.14..private2.6.14 <2>
@@ -274,14 +274,14 @@ $ mailx <3>
274
& s 2 3 4 5 ./+to-apply
275
& s 7 8 ./+hold-linus
276
& q
277
-$ git checkout -b topic/one master
277
+$ git switch -c topic/one master
278
$ git am -3 -i -s ./+to-apply <4>
279
$ compile/test
280
-$ git checkout -b hold/linus && git am -3 -i -s ./+hold-linus <5>
281
-$ git checkout topic/one && git rebase master <6>
282
-$ git checkout pu && git reset --hard next <7>
280
+$ git switch -c hold/linus && git am -3 -i -s ./+hold-linus <5>
281
+$ git switch topic/one && git rebase master <6>
282
+$ git switch -C pu next <7>
283
$ git merge topic/one topic/two && git merge hold/linus <8>
284
-$ git checkout maint
284
+$ git switch maint
285
$ git cherry-pick master~4 <9>
286
$ compile/test
287
$ git tag -s -m "GIT 0.99.9x" v0.99.9x <10>
Documentation/gittutorial.txt
+2
-2
@@ -207,7 +207,7 @@ automatically. The asterisk marks the branch you are currently on;
207
type
208
209
------------------------------------------------
210
-$ git checkout experimental
210
+$ git switch experimental
211
------------------------------------------------
212
213
to switch to the experimental branch. Now edit a file, commit the
@@ -216,7 +216,7 @@ change, and switch back to the master branch:
216
------------------------------------------------
217
(edit file)
218
$ git commit -a
219
-$ git checkout master
219
+$ git switch master
220
------------------------------------------------
221
222
Check that the change you made is no longer visible, since it was
Documentation/gitworkflows.txt
+1
-2
@@ -301,8 +301,7 @@ topics on 'next':
301
.Rewind and rebuild next
302
[caption="Recipe: "]
303
=====================================
304
-* `git checkout next`
305
-* `git reset --hard master`
304
+* `git switch -C next master`
305
* `git merge ai/topic_in_next1`
306
* `git merge ai/topic_in_next2`
307
* ...
Documentation/revisions.txt
+1
-1
@@ -115,7 +115,7 @@ Here's an example to make it more clear:
115
------------------------------
116
$ git config push.default current
117
$ git config remote.pushdefault myfork
118
-$ git checkout -b mybranch origin/master
118
+$ git switch -c mybranch origin/master
119
120
$ git rev-parse --symbolic-full-name @{upstream}
121
refs/remotes/origin/master
Documentation/user-manual.txt
+28
-28
@@ -122,10 +122,10 @@ Tags are expected to always point at the same version of a project,
122
while heads are expected to advance as development progresses.
123
124
Create a new branch head pointing to one of these versions and check it
125
-out using linkgit:git-checkout[1]:
125
+out using linkgit:git-switch[1]:
126
127
------------------------------------------------
128
-$ git checkout -b new v2.6.13
128
+$ git switch -c new v2.6.13
129
------------------------------------------------
130
131
The working directory then reflects the contents that the project had
@@ -282,10 +282,10 @@ a summary of the commands:
282
this command will fail with a warning.
283
`git branch -D <branch>`::
284
delete the branch `<branch>` irrespective of its merged status.
285
-`git checkout <branch>`::
285
+`git switch <branch>`::
286
make the current branch `<branch>`, updating the working
287
directory to reflect the version referenced by `<branch>`.
288
-`git checkout -b <new> <start-point>`::
288
+`git switch -c <new> <start-point>`::
289
create a new branch `<new>` referencing `<start-point>`, and
290
check it out.
291
@@ -302,22 +302,22 @@ ref: refs/heads/master
302
Examining an old version without creating a new branch
303
------------------------------------------------------
304
305
-The `git checkout` command normally expects a branch head, but will also
306
-accept an arbitrary commit; for example, you can check out the commit
307
-referenced by a tag:
305
+The `git switch` command normally expects a branch head, but will also
306
+accept an arbitrary commit when invoked with --detach; for example,
307
+you can check out the commit referenced by a tag:
308
309
------------------------------------------------
310
-$ git checkout v2.6.17
310
+$ git switch --detach v2.6.17
311
Note: checking out 'v2.6.17'.
312
313
You are in 'detached HEAD' state. You can look around, make experimental
314
changes and commit them, and you can discard any commits you make in this
315
-state without impacting any branches by performing another checkout.
315
+state without impacting any branches by performing another switch.
316
317
If you want to create a new branch to retain commits you create, you may
318
-do so (now or later) by using -b with the checkout command again. Example:
318
+do so (now or later) by using -c with the switch command again. Example:
319
320
- git checkout -b new_branch_name
320
+ git switch -c new_branch_name
321
322
HEAD is now at 427abfa Linux v2.6.17
323
------------------------------------------------
@@ -373,7 +373,7 @@ You might want to build on one of these remote-tracking branches
373
on a branch of your own, just as you would for a tag:
374
375
------------------------------------------------
376
-$ git checkout -b my-todo-copy origin/todo
376
+$ git switch -c my-todo-copy origin/todo
377
------------------------------------------------
378
379
You can also check out `origin/todo` directly to examine it or
@@ -2211,8 +2211,8 @@ $ git branch --track release origin/master
2211
These can be easily kept up to date using linkgit:git-pull[1].
2212
2213
-------------------------------------------------
2214
-$ git checkout test && git pull
2215
-$ git checkout release && git pull
2214
+$ git switch test && git pull
2215
+$ git switch release && git pull
2216
-------------------------------------------------
2217
2218
Important note! If you have any local changes in these branches, then
@@ -2264,7 +2264,7 @@ tested changes
2264
2) help future bug hunters that use `git bisect` to find problems
2265
2266
-------------------------------------------------
2267
-$ git checkout -b speed-up-spinlocks v2.6.35
2267
+$ git switch -c speed-up-spinlocks v2.6.35
2268
-------------------------------------------------
2269
2270
Now you apply the patch(es), run some tests, and commit the change(s). If
@@ -2279,7 +2279,7 @@ When you are happy with the state of this change, you can merge it into the
2279
"test" branch in preparation to make it public:
2280
2281
-------------------------------------------------
2282
-$ git checkout test && git merge speed-up-spinlocks
2282
+$ git switch test && git merge speed-up-spinlocks
2283
-------------------------------------------------
2284
2285
It is unlikely that you would have any conflicts here ... but you might if you
@@ -2291,7 +2291,7 @@ see the value of keeping each patch (or patch series) in its own branch. It
2291
means that the patches can be moved into the `release` tree in any order.
2292
2293
-------------------------------------------------
2294
-$ git checkout release && git merge speed-up-spinlocks
2294
+$ git switch release && git merge speed-up-spinlocks
2295
-------------------------------------------------
2296
2297
After a while, you will have a number of branches, and despite the
@@ -2512,7 +2512,7 @@ Suppose that you create a branch `mywork` on a remote-tracking branch
2512
`origin`, and create some commits on top of it:
2513
2514
-------------------------------------------------
2515
-$ git checkout -b mywork origin
2515
+$ git switch -c mywork origin
2516
$ vi file.txt
2517
$ git commit
2518
$ vi otherfile.txt
@@ -2552,7 +2552,7 @@ commits without any merges, you may instead choose to use
2552
linkgit:git-rebase[1]:
2553
2554
-------------------------------------------------
2555
-$ git checkout mywork
2555
+$ git switch mywork
2556
$ git rebase origin
2557
-------------------------------------------------
2558
@@ -3668,13 +3668,13 @@ change within the submodule, and then update the superproject to reference the
3668
new commit:
3669
3670
-------------------------------------------------
3671
-$ git checkout master
3671
+$ git switch master
3672
-------------------------------------------------
3673
3674
or
3675
3676
-------------------------------------------------
3677
-$ git checkout -b fix-up
3677
+$ git switch -c fix-up
3678
-------------------------------------------------
3679
3680
then
@@ -4194,7 +4194,7 @@ start.
4194
A good place to start is with the contents of the initial commit, with:
4195
4196
----------------------------------------------------
4197
-$ git checkout e83c5163
4197
+$ git switch --detach e83c5163
4198
----------------------------------------------------
4199
4200
The initial revision lays the foundation for almost everything Git has
@@ -4437,10 +4437,10 @@ Managing branches
4437
-----------------
4438
4439
-----------------------------------------------
4440
-$ git branch # list all local branches in this repo
4441
-$ git checkout test # switch working directory to branch "test"
4442
-$ git branch new # create branch "new" starting at current HEAD
4443
-$ git branch -d new # delete branch "new"
4440
+$ git branch # list all local branches in this repo
4441
+$ git switch test # switch working directory to branch "test"
4442
+$ git branch new # create branch "new" starting at current HEAD
4443
+$ git branch -d new # delete branch "new"
4444
-----------------------------------------------
4445
4446
Instead of basing a new branch on current HEAD (the default), use:
@@ -4456,7 +4456,7 @@ $ git branch new test~10 # ten commits before tip of branch "test"
4456
Create and switch to a new branch at the same time:
4457
4458
-----------------------------------------------
4459
-$ git checkout -b new v2.6.15
4459
+$ git switch -c new v2.6.15
4460
-----------------------------------------------
4461
4462
Update and examine branches from the repository you cloned from:
@@ -4467,7 +4467,7 @@ $ git branch -r # list
4467
origin/master
4468
origin/next
4469
...
4470
-$ git checkout -b masterwork origin/master
4470
+$ git switch -c masterwork origin/master
4471
-----------------------------------------------
4472
4473
Fetch a branch from a different repository, and give it a new
advice.c
+6
-6
@@ -191,20 +191,20 @@ void NORETURN die_conclude_merge(void)
191
void detach_advice(const char *new_name)
192
{
193
const char *fmt =
194
- _("Note: checking out '%s'.\n"
194
+ _("Note: switching to '%s'.\n"
195
"\n"
196
"You are in 'detached HEAD' state. You can look around, make experimental\n"
197
"changes and commit them, and you can discard any commits you make in this\n"
198
- "state without impacting any branches by performing another checkout.\n"
198
+ "state without impacting any branches by switching back to a branch.\n"
199
"\n"
200
"If you want to create a new branch to retain commits you create, you may\n"
201
- "do so (now or later) by using -b with the checkout command again. Example:\n"
201
+ "do so (now or later) by using -c with the switch command. Example:\n"
202
"\n"
203
- " git checkout -b <new-branch-name>\n"
203
+ " git switch -c <new-branch-name>\n"
204
"\n"
205
- "Or undo this checkout with:\n"
205
+ "Or undo this operation with:\n"
206
"\n"
207
- " git checkout -\n"
207
+ " git switch -\n"
208
"\n"
209
"Turn off this advice by setting config variable advice.detachedHead to false\n\n");
210
sha1-name.c
+1
-1
@@ -743,7 +743,7 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,
743
"because it will be ignored when you just specify 40-hex. These refs\n"
744
"may be created by mistake. For example,\n"
745
"\n"
746
- " git checkout -b $br $(git rev-parse ...)\n"
746
+ " git switch -c $br $(git rev-parse ...)\n"
747
"\n"
748
"where \"$br\" is somehow empty and a 40-hex ref is created. Please\n"
749
"examine these refs and maybe delete them. Turn this message off by\n"
t/t2020-checkout-detach.sh
+12
-12
@@ -195,20 +195,20 @@ test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not as
195
196
# The first detach operation is more chatty than the following ones.
197
cat >1st_detach <<-EOF &&
198
- Note: checking out 'HEAD^'.
198
+ Note: switching to 'HEAD^'.
199
200
You are in 'detached HEAD' state. You can look around, make experimental
201
changes and commit them, and you can discard any commits you make in this
202
- state without impacting any branches by performing another checkout.
202
+ state without impacting any branches by switching back to a branch.
203
204
If you want to create a new branch to retain commits you create, you may
205
- do so (now or later) by using -b with the checkout command again. Example:
205
+ do so (now or later) by using -c with the switch command. Example:
206
207
- git checkout -b <new-branch-name>
207
+ git switch -c <new-branch-name>
208
209
- Or undo this checkout with:
209
+ Or undo this operation with:
210
211
- git checkout -
211
+ git switch -
212
213
Turn off this advice by setting config variable advice.detachedHead to false
214
@@ -277,20 +277,20 @@ test_expect_success 'describe_detached_head does print SHA-1 ellipsis when asked
277
278
# The first detach operation is more chatty than the following ones.
279
cat >1st_detach <<-EOF &&
280
- Note: checking out 'HEAD^'.
280
+ Note: switching to 'HEAD^'.
281
282
You are in 'detached HEAD' state. You can look around, make experimental
283
changes and commit them, and you can discard any commits you make in this
284
- state without impacting any branches by performing another checkout.
284
+ state without impacting any branches by switching back to a branch.
285
286
If you want to create a new branch to retain commits you create, you may
287
- do so (now or later) by using -b with the checkout command again. Example:
287
+ do so (now or later) by using -c with the switch command. Example:
288
289
- git checkout -b <new-branch-name>
289
+ git switch -c <new-branch-name>
290
291
- Or undo this checkout with:
291
+ Or undo this operation with:
292
293
- git checkout -
293
+ git switch -
294
295
Turn off this advice by setting config variable advice.detachedHead to false
296
unpack-trees.c
+1
-1
@@ -313,7 +313,7 @@ static struct progress *get_progress(struct unpack_trees_options *o)
313
total++;
314
}
315
316
- return start_delayed_progress(_("Checking out files"), total);
316
+ return start_delayed_progress(_("Updating files"), total);
317
}
318
319
static void setup_collided_checkout_detection(struct checkout *state,