summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2019-04-27 12:02:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-07 04:23:13 (GMT)
commite3d6539d58238f046ff955330f6e10c447150164 (patch)
treea80e3a6d2e4814bf8b750edc027a05ed90d1e15e /Documentation
parent27434bf08c6c7c065e6323e8aa3f285d8f345e83 (diff)
downloadgit-e3d6539d58238f046ff955330f6e10c447150164.zip
git-e3d6539d58238f046ff955330f6e10c447150164.tar.gz
git-e3d6539d58238f046ff955330f6e10c447150164.tar.bz2
branch: make create_branch accept a merge base rev
When we ran something like $ git checkout -b test master... it would fail with the message fatal: Not a valid object name: 'master...'. This was caused by the call to `create_branch` where `start_name` is expected to be a valid rev. However, git-checkout allows the branch to be a valid _merge base_ rev (i.e. with a "...") so it was possible for an invalid rev to be passed in. Make `create_branch` accept a merge base rev so that this case does not error out. As a side-effect, teach git-branch how to handle merge base revs as well. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/git-branch.txt6
-rw-r--r--Documentation/git-checkout.txt4
2 files changed, 9 insertions, 1 deletions
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index 3bd83a7..8719e4c 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -45,7 +45,11 @@ argument is missing it defaults to `HEAD` (i.e. the tip of the current
branch).
The command's second form creates a new branch head named <branchname>
-which points to the current `HEAD`, or <start-point> if given.
+which points to the current `HEAD`, or <start-point> if given. As a
+special case, for <start-point>, 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 <newbranch>" to switch to the
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 8c3d412..d32f2eb 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -301,6 +301,10 @@ leave out at most one of `A` and `B`, in which case it defaults to `HEAD`.
<start_point>::
The name of a commit at which to start the new branch; see
linkgit:git-branch[1] for details. Defaults to HEAD.
++
+As a special case, 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`.
<tree-ish>::
Tree to checkout from (when paths are given). If not specified,