Steve Chambers Steve Chambers - 1 month ago 4
Git Question

How to use a two digit year format (e.g. 13 instead of 2013) in Git log entries?

I'm trying to maximize available space in each line of a customized Git log.

git log --date=short --pretty=format:"%ad ..."


is OK but gives dates in
yyyy-MM-dd
format (e.g. "2013-12-12").
With all the other stuff being logged on a limited length line, 2 characters becomes important!

Is there a way to output a two digit year (e.g. "12/12/13")?

Answer

There's nothing built in, but you could just output the date as a raw time stamp (--date=raw) and do your own post-processing on the log output. (Pipe the output to awk, python, perl, whatever, and have that replace the time-stamp values.)

Comments