Re: How to use git show's "%<(<N>[,trunc|ltrunc|mtrunc])"?
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Feb 3, 2017, 08:06 UTC
- Message-ID
- <CACsJy8DjqrEZ=VaZo6bn4i2r=Wr8k4ExYv48N-rDvfPO=hqpLA@mail.gmail.com>
- In-Reply-To
- <CAE1pOi0-8JnnZbdm9vu1RwTU1mXr7dboLC3ito3LcvK9gkNi_A@mail.gmail.com>
On Fri, Feb 3, 2017 at 12:51 AM, Hilco Wijbenga <hilco.wijbenga@gmail.com> wrote:
Show 13 quoted lines
> Hi all, > > I'm trying to get the committer date printed in a custom fashion. > Using "%cI" gets me close: > > $ git show --format="%cI | %an" master | head -n 1 > 2017-01-31T17:02:13-08:00 | Hilco Wijbenga > > I would like to get rid of the "-08:00" bit at the end of the > timestamp. According to the "git show" manual I should be able to use > "%<(<N>[,trunc|ltrunc|mtrunc])" to drop that last part. > > $ git show --format="%<(19,trunc)cI | %an" master | head -n 1
You're almost there. Just insert another '%' between "trunc)" and "cI".
> How do I get "2017-01-31T17:02:13 | Hilco Wijbenga" to be output?
You'll get an ellipsis at the end though.. (i.e. 02:13... | Hilco)
-- Duy