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

Re: [PATCH] doc: add that '-' is the same as '@{-1}'

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Mar 31, 2023, 16:29 UTC
Message-ID
<6c2c663d-9d91-3395-5dd5-844d6daef57a@dunelm.org.uk>
In-Reply-To
<pull.1484.git.git.1680257503697.gitgitgadget@gmail.com>
Hi ryicoh
On 31/03/2023 11:11, ryicoh via GitGitGadget wrote:
Show 5 quoted lines
> From: ryicoh <ryicoh@gmail.com>
> 
> Signed-off-by: ryicoh <ryicoh@gmail.com>
> ---
>      doc: add that '-' is the same as '@{-1}'

A few commands (checkout, merge, rebase and switch spring to mind) accept '-' as a shorthand for '@{-1}' but I don't think it is universally accepted.

Best Wishes
Phillip
Show 32 quoted lines
>      
>      Now, the document of '-' is written only git-switch.txt.
>      
>      https://github.com/git/git/blob/6369acd968d02899973a9a853c48029b92cea401/Documentation/git-switch.txt#L51
>      
>      I want same one in revisions.txt.
>      
>      Thank you.
> 
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1484%2Fryicoh%2Fdoc-hyphen-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1484/ryicoh/doc-hyphen-v1
> Pull-Request: https://github.com/git/git/pull/1484
> 
>   Documentation/revisions.txt | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt
> index 9aa58052bc7..9e7ea2cf71e 100644
> --- a/Documentation/revisions.txt
> +++ b/Documentation/revisions.txt
> @@ -94,7 +94,8 @@ some output processing may assume ref names in UTF-8.
>   
>   '@{-<n>}', e.g. '@{-1}'::
>     The construct '@{-<n>}' means the <n>th branch/commit checked out
> -  before the current one.
> +  before the current one. You may also specify - which is synonymous
> +  to @{-1}.
>   
>   '[<branchname>]@\{upstream\}', e.g. 'master@\{upstream\}', '@\{u\}'::
>     A branch B may be set up to build on top of a branch X (configured with
> 
> base-commit: 6369acd968d02899973a9a853c48029b92cea401
Previous: Junio C Hamano
Message 6 of 6 in “doc: add that '-' is the same as '@{-1}'”
  1. doc: add that '-' is the same as '@{-1}'ryicoh via GitGitGadget, Mar 31, 2023
  2. Oswald BuddenhagenMar 31, 2023
  3. Junio C HamanoMar 31, 2023
  4. ryicohApr 1, 2023
  5. Junio C HamanoApr 2, 2023
  6. Phillip WoodMar 31, 2023

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.