# git log --oneline cannot display dates

2 messages from 2018-04-02 to 2018-04-02. Participants: David Hoyle, Jeff King.
Thread: https://gitlist.dev/t/48201

## David Hoyle, 2018-04-02 12:05

Subject: git log --oneline cannot display dates
Message-ID: <CAFGVh0zWuqa5HswE7JAx3-bOSGGaRAgLa6ULy--+yn_iD5eJRQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAFGVh0zWuqa5HswE7JAx3-bOSGGaRAgLa6ULy--%2Byn_iD5eJRQ%40mail.gmail.com

```
When using the git log command with the --oneline switch, you cannot
add the --date=<date> switch to see the dates. The only workaround is
to create an alias and use the --pretty-format which doesn't provide
the ability to colour the branch and tag information (as far as i can
tell).

regards
David Hoyle.

```

## Jeff King, 2018-04-02 12:40

Subject: Re: git log --oneline cannot display dates
Message-ID: <20180402124059.GA396@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20180402124059.GA396%40sigill.intra.peff.net
In-Reply-To: <CAFGVh0zWuqa5HswE7JAx3-bOSGGaRAgLa6ULy--+yn_iD5eJRQ@mail.gmail.com>

```
On Mon, Apr 02, 2018 at 01:05:01PM +0100, David Hoyle wrote:

> When using the git log command with the --oneline switch, you cannot
> add the --date=<date> switch to see the dates.

Right. --date is just about selecting which date format to show, not
whether to show one. The decision of what to show is up to the format,
and --oneline does not include a date.

> The only workaround is
> to create an alias and use the --pretty-format which doesn't provide
> the ability to colour the branch and tag information (as far as i can
> tell).

You can use "%C(auto)" to turn on auto-coloring for various components:

  git log --format='%C(auto)%h%d %s'

which reproduces the usual coloring and format of --oneline. Then you
should be able to add in your own date, colored as you wish. E.g.:

  git log --format='%C(auto)%h%d %C(blue)%ad%C(reset) %s'

If you want to use this a lot, you may want to look into the "pretty.*"
config so you can trigger it with a short name.

-Peff

```
