diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-12-28 01:52:24 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-12-28 01:52:24 +0300 |
commit | f09e74175dfa5b46587dab3c5dcbad16e9586de3 (patch) | |
tree | 98626534b7796b0deb7948757fc5ec78b58166b2 /Documentation | |
parent | 055bb6e9969085777b7fab83e3fee0017654f134 (diff) | |
parent | b23285a921a84c3b83d9aaca31afedf290c59254 (diff) |
Merge branch 'jc/checkout-B-branch-in-use'
"git checkout -B <branch> [<start-point>]" allowed a branch that is
in use in another worktree to be updated and checked out, which
might be a bit unexpected. The rule has been tightened, which is a
breaking change. "--ignore-other-worktrees" option is required to
unbreak you, if you are used to the current behaviour that "-B"
overrides the safety.
* jc/checkout-B-branch-in-use:
checkout: forbid "-B <branch>" from touching a branch used elsewhere
checkout: refactor die_if_checked_out() caller
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/git-checkout.txt | 4 | ||||
-rw-r--r-- | Documentation/git-switch.txt | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 240c54639e..55a50b5b23 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -63,7 +63,9 @@ $ git checkout <branch> ------------ + that is to say, the branch is not reset/created unless "git checkout" is -successful. +successful (e.g., when the branch is in use in another worktree, not +just the current branch stays the same, but the branch is not reset to +the start-point, either). 'git checkout' --detach [<branch>]:: 'git checkout' [--detach] <commit>:: diff --git a/Documentation/git-switch.txt b/Documentation/git-switch.txt index c60fc9c138..6137421ede 100644 --- a/Documentation/git-switch.txt +++ b/Documentation/git-switch.txt @@ -59,13 +59,18 @@ out at most one of `A` and `B`, in which case it defaults to `HEAD`. -c <new-branch>:: --create <new-branch>:: Create a new branch named `<new-branch>` starting at - `<start-point>` before switching to the branch. This is a - convenient shortcut for: + `<start-point>` before switching to the branch. This is the + transactional equivalent of + ------------ $ git branch <new-branch> $ git switch <new-branch> ------------ ++ +that is to say, the branch is not reset/created unless "git switch" is +successful (e.g., when the branch is in use in another worktree, not +just the current branch stays the same, but the branch is not reset to +the start-point, either). -C <new-branch>:: --force-create <new-branch>:: |