Re: [PATCH] refspec: make @ a valid refspec
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 24, 2020, 23:14 UTC
- Message-ID
- <xmqqk0uagxei.fsf@gitster.c.googlers.com>
- In-Reply-To
- <CA+P7+xr8_s0Fq_TGjDjHEPpGJ8Br5x7omY1fsg0HjcXjutyRkg@mail.gmail.com>
Jacob Keller <jacob.keller@gmail.com> writes:
Show 9 quoted lines
>> Worse yet, @{4} does not refer to HEAD@{4} but refers to the 4-th
>> previous commit the current branch pointed at, so a mnemonic for the
>> end user to remember the distinction between the two is that a bare
>> "@" is different from HEAD, which is a total opposite X-<.
>>
>
> However, @{0} *does* refer to what is currently checked out, which
> would be head.. So in a sense @ meaning "the current branch" and
> applying @{0} would always be HEAD, no?Not really.
It happens to hold true for @{0}, because by definition you couldn't have been on a different branch than the current one when you made the topmost commit on the current branch. For @{1} and higher, it is always "where was the current branch at N commits ago?" which is different from "where was the HEAD at N commits ago?", unless you always use a single branch and never switch away.