threads / discuss / 62803

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

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

## tl;dr

2 messages between Jan 14, 2025 and Jan 14, 2025.

replies: 1people: 2as markdown or json

tao lv· Jan 14, 2025, 11:01 UTC · lore
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
Kristoffer Haugsbakk· Jan 14, 2025, 11:14 UTC · re: tao lv · lore

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

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

← back to recent threads