# The meaning of x~0 and x~ as rev-spec.

3 messages from 2008-03-14 to 2008-03-14. Participants: Sergei Organov, Junio C Hamano.
Thread: https://gitlist.dev/t/12690

## Sergei Organov, 2008-03-14 13:20

Subject: The meaning of x~0 and x~ as rev-spec.
Message-ID: <87bq5ho31d.fsf@osv.gnss.ru>
URL: https://gitlist.dev/e/87bq5ho31d.fsf%40osv.gnss.ru

```
Hello,

Testing suggests that <name>~0 and <name>~ are the same and are just
synonyms for <name> as rev-specs. Is that correct? Is that by design, or
by accident?

Shouldn't <name>~0 have [the same] special meaning as <name>^0?

Shouldn't <name>~ be a short-cut for <name>~1, similar to <name>^?

Anyway, I think that at least <name>~0 (useful for scripting) should be
explicitly documented, provided that <name>^0 has special (and
documented) meaning.

[
The question arose when I wanted to write something like this to
automate reverting of a few last revisions:

  for i in 0 1 2 3; do
      git revert -n HEAD~$i
  done
  git commit -a
]
 
-- Sergei.

```

## Junio C Hamano, 2008-03-14 16:24

Subject: Re: The meaning of x~0 and x~ as rev-spec.
Message-ID: <7vwso5p92q.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vwso5p92q.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <87bq5ho31d.fsf@osv.gnss.ru>

```
Sergei Organov <osv@javad.com> writes:

> Testing suggests that <name>~0 and <name>~ are the same and are just
> synonyms for <name> as rev-specs. Is that correct? Is that by design, or
> by accident?

sed -n -e '/name~3/,/x = 0;/p' sha1_name.c

```

## Sergei Organov, 2008-03-14 17:21

Subject: Re: The meaning of x~0 and x~ as rev-spec.
Message-ID: <87zlt1mdb9.fsf@osv.gnss.ru>
URL: https://gitlist.dev/e/87zlt1mdb9.fsf%40osv.gnss.ru
In-Reply-To: <7vwso5p92q.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> writes:

> Sergei Organov <osv@javad.com> writes:
>
>> Testing suggests that <name>~0 and <name>~ are the same and are just
>> synonyms for <name> as rev-specs. Is that correct? Is that by design, or
>> by accident?
>
> sed -n -e '/name~3/,/x = 0;/p' sha1_name.c

OK, I'll send a patch for documentation.

-- Sergei.

```
