git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Feature request for shorter relative date format in log

From
YZYucheng Zhou <zhouyucheng98@outlook.com>
Date
Aug 3, 2023, 02:54 UTC
Message-ID
<MEYP282MB2280E174A5B4FFE11DDB5C40BE08A@MEYP282MB2280.AUSP282.PROD.OUTLOOK.COM>
In-Reply-To
<xmqqsf915b54.fsf@gitster.g>
Thank you for your reply!

Actually, I think there is no need to allow users to config the switching of granularity. The current relative format has already done a great job. What I want is, a handy way to show a shorter relative date (like the “--short” flag in git status). And the current switching of granularity should be reused.

The only thing need to be changed, is the vocabulary for representation. For example, the “2 minutes ago” can be represented in “2m”, and “10 days ago” to “10d”. If both the past and future timestamps should be taken into account, we can use a prefix “-” and “+” to distinguish them. But I think we hardly see a future timestamp in the git log output, so we can let the past timestamps un-prefixed and only prefix the future ones with a “+”, maybe.

The rationale of this feature is saving space in the output, to let more useful information be shown in one line. For instance, many skilled git users use customized one-line formats in git log, such as “<hash> <date> <author> <title-line>”. Where the <date> can be shortened as much as possible to save space for other important things (especially using with --graph or --decorate). Therefore, a shorter relative date representation of no more than about 3 characters can be a great idea.

To achieve this, a new format like “relative-short” can be introduced. There is no need to let users config so many things. Since there already exists “--date=short” for short absolute date format and “--date=default-local” which consists of two words, I think a new option “--date=relative-short” with a well-designed shorter representation will be very handy and great.
Previous: Junio C HamanoNext: Taylor Blau
Message 4 of 5 in “Feature request for shorter relative date format in log”
  1. Yucheng ZhouAug 2, 2023
  2. Taylor BlauAug 2, 2023
  3. Junio C HamanoAug 2, 2023
  4. Yucheng ZhouAug 3, 2023
  5. Taylor BlauAug 4, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.