# Why does "git log --reverse -1" print the HEAD commit?

3 messages from 2008-05-31 to 2008-05-31. Participants: Teemu Likonen, Miklos Vajna.
Thread: https://gitlist.dev/t/13740

## Teemu Likonen, 2008-05-31 14:11

Subject: Why does "git log --reverse -1" print the HEAD commit?
Message-ID: <20080531141102.GA3035@mithlond.arda.local>
URL: https://gitlist.dev/e/20080531141102.GA3035%40mithlond.arda.local

```
It feels wrong that "git log -1" and "git log --reverse -1" both print
the same commit: HEAD. Why is that?

Since "git log --reverse" starts from the bottom I'd have expected "-1"
to print one commit from the bottom.

```

## Miklos Vajna, 2008-05-31 14:24

Subject: Re: Why does "git log --reverse -1" print the HEAD commit?
Message-ID: <20080531142408.GL29404@genesis.frugalware.org>
URL: https://gitlist.dev/e/20080531142408.GL29404%40genesis.frugalware.org
In-Reply-To: <20080531141102.GA3035@mithlond.arda.local>

```
On Sat, May 31, 2008 at 05:11:02PM +0300, Teemu Likonen <tlikonen@iki.fi> wrote:
> It feels wrong that "git log -1" and "git log --reverse -1" both print
> the same commit: HEAD. Why is that?
> 
> Since "git log --reverse" starts from the bottom I'd have expected "-1"
> to print one commit from the bottom.

-1 limits the commit list to one element and then it prints that range
in reverse order, which is the same for a single commit.

```

## Teemu Likonen, 2008-05-31 14:33

Subject: Re: Why does "git log --reverse -1" print the HEAD commit?
Message-ID: <20080531143327.GA4121@mithlond.arda.local>
URL: https://gitlist.dev/e/20080531143327.GA4121%40mithlond.arda.local
In-Reply-To: <20080531142408.GL29404@genesis.frugalware.org>

```
Miklos Vajna wrote (2008-05-31 16:24 +0200):

> On Sat, May 31, 2008 at 05:11:02PM +0300, Teemu Likonen
> <tlikonen@iki.fi> wrote:
> > It feels wrong that "git log -1" and "git log --reverse -1" both
> > print the same commit: HEAD. Why is that?
> > 
> > Since "git log --reverse" starts from the bottom I'd have expected
> > "-1" to print one commit from the bottom.
> 
> -1 limits the commit list to one element and then it prints that range
> in reverse order, which is the same for a single commit.

Oh yeah, that's the logic, thanks. I find it counter-intuitive but I'll
survive.

```
