git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 2/4] Doc: document "A...B" form for <tree-ish> in checkout and switch

From
Denton Liu <liu.denton@gmail.com>
Date
Oct 7, 2020, 07:56 UTC
Message-ID
<a0ed2f313d606bb889f0d7520cc38a38d72a9a36.1602057332.git.liu.denton@gmail.com>
In-Reply-To
<cover.1602057332.git.liu.denton@gmail.com>

Using "A...B" has been supported for the <tree-ish> argument for a while. However, its support has never been explicitly documented.

Explicitly document it so that users know that it is available.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
 Documentation/git-checkout.txt | 4 ++++
 Documentation/git-restore.txt  | 4 ++++
 2 files changed, 8 insertions(+)
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index afa5c11fd3..6ae8bf8dee 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -351,6 +351,10 @@ 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,
 	the index will be used.
++
+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`.
 
 \--::
 	Do not interpret any more arguments as options.
diff --git a/Documentation/git-restore.txt b/Documentation/git-restore.txt
index 84c6c40010..55bde91ef9 100644
--- a/Documentation/git-restore.txt
+++ b/Documentation/git-restore.txt
@@ -40,6 +40,10 @@ OPTIONS
 +
 If not specified, the contents are restored from `HEAD` if `--staged` is
 given, otherwise from the index.
++
+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`.
 
 -p::
 --patch::
-- 
2.28.0.942.g77c4c6094c
Previous: Denton LiuNext: Denton Liu
Message 7 of 9 in “checkout/restore: fix `git checkout -p HEAD...` bug”
  1. 0/2 checkout/restore: fix `git checkout -p HEAD...` bugDenton Liu, Oct 4, 2020
  2. 1/2 builtin/checkout: fix `git checkout -p HEAD...` bugDenton Liu, Oct 4, 2020
  3. Junio C HamanoOct 4, 2020
  4. 2/2 Doc: document "A...B" form for <tree-ish> in checkout and switchDenton Liu, Oct 4, 2020
  5. 0/4 checkout/restore: fix `git checkout -p HEAD...` bugDenton Liu, Oct 7, 2020
  6. 1/4 builtin/checkout: fix `git checkout -p HEAD...` bugDenton Liu, Oct 7, 2020
  7. 2/4 Doc: document "A...B" form for <tree-ish> in checkout and switchDenton Liu, Oct 7, 2020
  8. 4/4 t2016: add a NEEDSWORK about the PERL prerequisiteDenton Liu, Oct 7, 2020
  9. 3/4 add-patch: add NEEDSWORK about comparing commitsDenton Liu, Oct 7, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.