Skip to contentSkip to conversation

doc: commit: document special date keywords for --date

PATCH In review Md Ferdous Alam via GitGitGadget 3 participants 3 messages Feb 23 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 doc: commit: document special date keywords for --date

From: mdferdousalam <[email protected]>

The --date option in git-commit accepts human-readable keywords like "now", "yesterday", "noon", "midnight", "tea", and "never", but these were not documented. Add them to the "DATE FORMATS" section of git-commit(1), and expand the --date option description to point readers there.

---
doc: commit: document special date keywords for --date

The --date option in git-commit accepts human-readable keywords like "now", "yesterday", "noon", "midnight", "tea", and "never", but these were not documented. Add them to the "DATE FORMATS" section of git-commit(1), and expand the --date option description to point readers there.

This addresses https://github.com/gitgitgadget/git/issues/302

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2051%2Fmdferdousalam%2Fdoc-commit-date-special-strings-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2051/mdferdousalam/doc-commit-date-special-strings-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2051

 Documentation/date-formats.adoc | 12 ++++++++++++
 Documentation/git-commit.adoc   |  5 ++++-
 2 files changed, 16 insertions(+), 1 deletion(-)
Documentation/date-formats.adoc +12 -0
index e24517c496..cbf651a8be 100644
@@ -28,4 +28,16 @@ ifdef::git-commit[]
 In addition to recognizing all date formats above, the `--date` option
 will also try to make sense of other, more human-centric date formats,
 such as relative dates like "yesterday" or "last Friday at noon".
++
+The following special keywords are also recognized:
++
+`now`;; the current date and time.
+`yesterday`;; yesterday's date at the current time.
+`noon`;; today (or the given date) at 12:00.
+`midnight`;; today (or the given date) at 00:00.
+`tea`;; today (or the given date) at 17:00.
+`never`;; a zero timestamp (used e.g. by linkgit:git-reflog[1]).
++
+These keywords can be combined with other date constructs, for
+example `yesterday noon` or `3.days.ago`.
 endif::git-commit[]
Documentation/git-commit.adoc +4 -1
index 8329c1034b..840bc52096 100644
@@ -181,7 +181,10 @@ See linkgit:git-rebase[1] for details.
 	the commit author is then copied from the first such commit found.
 
 `--date=<date>`::
-	Override the author date used in the commit.
+	Override the author date used in the commit.  See the
+	"DATE FORMATS" section below for accepted formats,
+	including human-readable strings like `now`, `yesterday`,
+	and `noon`.
 
 `-m <msg>`::
 `--message=<msg>`::

base-commit: 7c02d39fc2ed2702223c7674f73150d9a7e61ba4

Signature · 1 line
gitgitgadget
#1 lore raw
Quoted 5 lines · Md Ferdous Alam via GitGitGadget

From: mdferdousalam <[email protected]>

The --date option in git-commit accepts human-readable keywords like "now", "yesterday", "noon", "midnight", "tea", and "never", but these were not documented.

I've always thought that these are easter eggs to be discovered, deliberately left out of documentation, as they mostly exist to be amusing. For those who want to be precise, the date formats section gives sufficient information.

Other than perhaps "now", which may be handy but not so useful in the context of "git commit --date=now".

Moreover, 7.days.ago and 1.week.ago are also in the same category as what you called "keywords" here, but we do not try to make an exhausitive list.

So, I dunno.

#2 lore raw
Quoted 10 lines · Junio C Hamano

I've always thought that these are easter eggs to be discovered, deliberately left out of documentation, as they mostly exist to be amusing.  For those who want to be precise, the date formats section gives sufficient information.

Moreover, 7.days.ago and 1.week.ago are also in the same category as what you called "keywords" here, but we do not try to make an exhausitive list.

So, I dunno.

That makes sense.  I had not considered that these were intentionally left undocumented as easter eggs.  And you are right that trying to list some without listing all (like 7.days.ago) would be incomplete and misleading.

I will withdraw this patch.  Thank you for the explanation.

Md Ferdous Alam

On Monday, February 23, 2026 at 11:10:23 PM GMT+6, Junio C Hamano <[email protected]> wrote:

Quoted 5 lines · Md Ferdous Alam via GitGitGadget

From: mdferdousalam <[email protected]>

The --date option in git-commit accepts human-readable keywords like "now", "yesterday", "noon", "midnight", "tea", and "never", but these were not documented.

I've always thought that these are easter eggs to be discovered, deliberately left out of documentation, as they mostly exist to be amusing.  For those who want to be precise, the date formats section gives sufficient information.

Other than perhaps "now", which may be handy but not so useful in the context of "git commit --date=now".

Moreover, 7.days.ago and 1.week.ago are also in the same category as what you called "keywords" here, but we do not try to make an exhausitive list.

So, I dunno.