]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-checkout.c
"checkout A...B" switches to the merge base between A and B
[thirdparty/git.git] / builtin-checkout.c
index da04eed39104446c7c82dd846f8ddfd785d761e2..fe7c8584caa5133c553e30a186f47a266dc508a4 100644 (file)
@@ -689,7 +689,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
         * case 3: git checkout <something> [<paths>]
         *
         *   With no paths, if <something> is a commit, that is to
-        *   switch to the branch or detach HEAD at it.
+        *   switch to the branch or detach HEAD at it.  As a special case,
+        *   if <something> is A...B (missing A or B means HEAD but you can
+        *   omit at most one side), and if there is a unique merge base
+        *   between A and B, A...B names that merge base.
         *
         *   With no paths, if <something> is _not_ a commit, no -t nor -b
         *   was given, and there is a tracking branch whose name is
@@ -715,7 +718,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
                if (!strcmp(arg, "-"))
                        arg = "@{-1}";
 
-               if (get_sha1(arg, rev)) {
+               if (get_sha1_mb(arg, rev)) {
                        if (has_dash_dash)          /* case (1) */
                                die("invalid reference: %s", arg);
                        if (!patch_mode &&