mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
![Nguyễn Thái Ngọc Duy](/assets/img/avatar_default.png)
When we switch from one branch to another, it makes sense to show a
summary of local changes since there could be conflicts, or some files
left modified.... When switch is used solely for creating a new
branch (and "switch" to the same commit) or detaching, we don't really
need to show anything.
"git checkout" does it anyway for historical reasons. But we can start
with a clean slate with switch and don't have to.
This essentially reverts fa655d8411
(checkout: optimize "git checkout
-b <new_branch>" - 2018-08-16) and make it default for switch,
but also for -B and --detach. Users of big repos are encouraged to
move to switch.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 lines
842 B
Plaintext
19 lines
842 B
Plaintext
checkout.defaultRemote::
|
|
When you run 'git checkout <something>'
|
|
or 'git switch <something>' and only have one
|
|
remote, it may implicitly fall back on checking out and
|
|
tracking e.g. 'origin/<something>'. This stops working as soon
|
|
as you have more than one remote with a '<something>'
|
|
reference. This setting allows for setting the name of a
|
|
preferred remote that should always win when it comes to
|
|
disambiguation. The typical use-case is to set this to
|
|
`origin`.
|
|
+
|
|
Currently this is used by linkgit:git-switch[1] and
|
|
linkgit:git-checkout[1] when 'git checkout <something>'
|
|
or 'git switch <something>'
|
|
will checkout the '<something>' branch on another remote,
|
|
and by linkgit:git-worktree[1] when 'git worktree add' refers to a
|
|
remote branch. This setting might be used for other checkout-like
|
|
commands or functionality in the future.
|