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

Re: Feature Request: Allow `-` as a Shortcut for `@{-1}` in `git diff`

From
KHKristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Date
Jan 14, 2025, 11:14 UTC
Message-ID
<85491d3b-336c-4b48-b16e-962012b4f5f7@app.fastmail.com>
In-Reply-To
<CAFePT4w4hHZnS0TXGA6-_sA-Vp4f3H_sY2Ue1XreFM3SEM8i2g@mail.gmail.com>
On Tue, Jan 14, 2025, at 12:01, tao lv wrote:
Show 10 quoted lines
> Hi,
>
> I would like to request a feature for `git diff`: to allow the use of
> `-` as a shortcut for `@{-1}`. Currently, `git merge` and `git
> checkout` both support using `-` as a shortcut for `@{-1}`, and I hope
> this functionality can be extended to `git diff` as well.
>
> Thank you for considering this request.
>
> Best regards
For what it’s worth: a patch to add this for git-branch(1) was rejected in 2022:
https://lore.kernel.org/git/xmqqedwgfpkr.fsf@gitster.g/
-- 
Kristoffer Haugsbakk
Previous: tao lv
Message 2 of 2 in “Feature Request: Allow `-` as a Shortcut for `@{-1}` in `git diff`”
  1. tao lvJan 14, 2025
  2. Kristoffer HaugsbakkJan 14, 2025

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.