From: Junio C Hamano Date: Tue, 9 Jul 2019 22:25:44 +0000 (-0700) Subject: Merge branch 'nd/switch-and-restore' X-Git-Tag: v2.23.0-rc0~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f496b064fc1135e0dded7f93d85d72eb0b302c22;p=thirdparty%2Fgit.git Merge branch 'nd/switch-and-restore' Two new commands "git switch" and "git restore" are introduced to split "checking out a branch to work on advancing its history" and "checking out paths out of the index and/or a tree-ish to work on advancing the current history" out of the single "git checkout" command. * nd/switch-and-restore: (46 commits) completion: disable dwim on "git switch -d" switch: allow to switch in the middle of bisect t2027: use test_must_be_empty Declare both git-switch and git-restore experimental help: move git-diff and git-reset to different groups doc: promote "git restore" user-manual.txt: prefer 'merge --abort' over 'reset --hard' completion: support restore t: add tests for restore restore: support --patch restore: replace --force with --ignore-unmerged restore: default to --source=HEAD when only --staged is specified restore: reject invalid combinations with --staged restore: add --worktree and --staged checkout: factor out worktree checkout code restore: disable overlay mode by default restore: make pathspec mandatory restore: take tree-ish from --source option instead checkout: split part of it to new command 'restore' doc: promote "git switch" ... --- f496b064fc1135e0dded7f93d85d72eb0b302c22 diff --cc Documentation/git-branch.txt index 16e14c6282,1e2d89b174..135206ff4a --- a/Documentation/git-branch.txt +++ b/Documentation/git-branch.txt @@@ -53,14 -45,10 +53,14 @@@ argument is missing it defaults to `HEA branch). The command's second form creates a new branch head named -which points to the current `HEAD`, or if given. +which points to the current `HEAD`, or if given. As a +special case, for , you may use `"A...B"` as a shortcut for +the merge base of `A` and `B` if there is exactly one merge base. You +can leave out at most one of `A` and `B`, in which case it defaults to +`HEAD`. Note that this will create the new branch, but it will not switch the - working tree to it; use "git checkout " to switch to the + working tree to it; use "git switch " to switch to the new branch. When a local branch is started off a remote-tracking branch, Git sets up the diff --cc Documentation/git-checkout.txt index 964f912d29,a294652dd6..cf3cac0a2b --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@@ -242,13 -255,11 +255,13 @@@ should result in deletion of the path) + When checking out paths from the index, this option lets you recreate the conflicted merge in the specified paths. ++ +When switching branches with `--merge`, staged changes may be lost. --conflict=