[PATCH] Documentation: updated documentation for git commit --date

Subsystems: documentation, the rest

STALE2020d

6 messages, 3 authors, 2021-03-29 · open the first message on its own page

[PATCH] Documentation: updated documentation for git commit --date

From: Chinmoy via GitGitGadget <hidden>
Date: 2021-03-28 10:20:29

From: Chinmoy Chakraborty <redacted>

This commit lists the special strings used with `--date`
in `git-commit.txt` and also a brief explanation about
the strings in `date-formats.txt`.

Signed-off-by: Chinmoy Chakraborty <redacted>
---
    Documentation: updated documentation for git commit --date
    
    This commit lists the special strings used with --date in git-commit.txt
    and also a brief explanation about the strings in date-formats.txt.
    
    Signed-off-by: Chinmoy Chakraborty chinmoy12c@gmail.com
    
    
    Related Issue
    =============
    
    #302

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-918%2Fchinmoy12c%2Fissue_302-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-918/chinmoy12c/issue_302-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/918

 Documentation/date-formats.txt | 32 ++++++++++++++++++++++++++++++++
 Documentation/git-commit.txt   |  5 ++++-
 2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/Documentation/date-formats.txt b/Documentation/date-formats.txt
index 99c455f51c04..66dae179eb66 100644
--- a/Documentation/date-formats.txt
+++ b/Documentation/date-formats.txt
@@ -1,6 +1,38 @@
+[[DATE FORMATS]]
 DATE FORMATS
 ------------
 
+`yesterday`::
+	Change commit time to yesterday, that is, 24 hours ago.
+
+`noon`::
+	Change commit time to noon, that is 12:00. If current
+	time is less than 12:00, the time will be set to 12:00
+	on the previous day, else it will be set to 12:00 on
+	the same day.
+
+`midnight`::
+	Change commit time to midnight, that is, 00:00.
+
+`tea`::
+	Change commit time to 17:00(tea time). If the current
+	time is less than 17:00, the time will be set to 17:00
+	on the previous day, else it will be set to 17:00 on
+	the same day.
+
+`PM`::
+	Change commit time from AM to PM. If the current time
+	is already greater than 12:00, then the time remains
+	unaltered.
+
+`AM`::
+	Change commit time from PM to AM. If current time is
+	already less than 12:00, then the time remains
+	unaltered.
+
+`now`::
+	Change commit time to current time.
+
 The `GIT_AUTHOR_DATE` and `GIT_COMMITTER_DATE` environment variables
 support the following date formats:
 
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 3c69f461c9af..b2f51cdcafaf 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -176,7 +176,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. The value of <date>
+	may be any one of the following special values - "yesterday",
+	"noon", "midnight", "tea", "PM", "AM", "never", "now"
+	(see <<DATE FORMATS>>).
 
 -m <msg>::
 --message=<msg>::
base-commit: 84d06cdc06389ae7c462434cb7b1db0980f63860
-- 
gitgitgadget

[PATCH v2] Documentation: updated documentation for git commit --date

From: Chinmoy via GitGitGadget <hidden>
Date: 2021-03-28 12:56:00

From: Chinmoy Chakraborty <redacted>

This commit lists the special strings used with `--date`
in `git-commit.txt` and also a brief explanation about
the strings in `date-formats.txt`.

Signed-off-by: Chinmoy Chakraborty <redacted>
---
    Documentation: updated documentation for git commit --date
    
    This commit lists the special strings used with --date in git-commit.txt
    and also a brief explanation about the strings in date-formats.txt.
    
    Signed-off-by: Chinmoy Chakraborty chinmoy12c@gmail.com
    
    
    Related Issue
    =============
    
    #302

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-918%2Fchinmoy12c%2Fissue_302-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-918/chinmoy12c/issue_302-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/918

Range-diff vs v1:

 1:  818ac39b5203 ! 1:  20da93dea971 Documentation: updated documentation for git commit --date
     @@ Commit message
      
       ## Documentation/date-formats.txt ##
      @@
     -+[[DATE FORMATS]]
     ++[[DATE-FORMATS]]
       DATE FORMATS
       ------------
       
     @@ Documentation/git-commit.txt: See linkgit:git-rebase[1] for details.
      +	Override the author date used in the commit. The value of <date>
      +	may be any one of the following special values - "yesterday",
      +	"noon", "midnight", "tea", "PM", "AM", "never", "now"
     -+	(see <<DATE FORMATS>>).
     ++	(see <<DATE-FORMATS>>).
       
       -m <msg>::
       --message=<msg>::


 Documentation/date-formats.txt | 32 ++++++++++++++++++++++++++++++++
 Documentation/git-commit.txt   |  5 ++++-
 2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/Documentation/date-formats.txt b/Documentation/date-formats.txt
index 99c455f51c04..83c423a3ec2e 100644
--- a/Documentation/date-formats.txt
+++ b/Documentation/date-formats.txt
@@ -1,6 +1,38 @@
+[[DATE-FORMATS]]
 DATE FORMATS
 ------------
 
+`yesterday`::
+	Change commit time to yesterday, that is, 24 hours ago.
+
+`noon`::
+	Change commit time to noon, that is 12:00. If current
+	time is less than 12:00, the time will be set to 12:00
+	on the previous day, else it will be set to 12:00 on
+	the same day.
+
+`midnight`::
+	Change commit time to midnight, that is, 00:00.
+
+`tea`::
+	Change commit time to 17:00(tea time). If the current
+	time is less than 17:00, the time will be set to 17:00
+	on the previous day, else it will be set to 17:00 on
+	the same day.
+
+`PM`::
+	Change commit time from AM to PM. If the current time
+	is already greater than 12:00, then the time remains
+	unaltered.
+
+`AM`::
+	Change commit time from PM to AM. If current time is
+	already less than 12:00, then the time remains
+	unaltered.
+
+`now`::
+	Change commit time to current time.
+
 The `GIT_AUTHOR_DATE` and `GIT_COMMITTER_DATE` environment variables
 support the following date formats:
 
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 3c69f461c9af..1935fad33f35 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -176,7 +176,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. The value of <date>
+	may be any one of the following special values - "yesterday",
+	"noon", "midnight", "tea", "PM", "AM", "never", "now"
+	(see <<DATE-FORMATS>>).
 
 -m <msg>::
 --message=<msg>::
base-commit: 84d06cdc06389ae7c462434cb7b1db0980f63860
-- 
gitgitgadget

Re: [PATCH v2] Documentation: updated documentation for git commit --date

From: Bagas Sanjaya <hidden>
Date: 2021-03-29 05:33:43

On 28/03/21 19.54, Chinmoy via GitGitGadget wrote:
From: Chinmoy Chakraborty <redacted>

This commit lists the special strings used with `--date`
in `git-commit.txt` and also a brief explanation about
the strings in `date-formats.txt`.

Signed-off-by: Chinmoy Chakraborty <redacted>
---
Is date format parsing specific to git commit? If so, then
why not date-formats.txt be merged to `DATE FORMATS` section
of git-commit documentation? Also, what commit this `--date`
option first appeared before you write this documentation?
quoted hunk
+`tea`::
+	Change commit time to 17:00(tea time). If the current
+	time is less than 17:00, the time will be set to 17:00
+	on the previous day, else it will be set to 17:00 on
+	the same day.
How useful is this argument?

-- 
An old man doll... just what I always wanted! - Clara

Re: [PATCH v2] Documentation: updated documentation for git commit --date

From: Chinmoy Chakraborty <hidden>
Date: 2021-03-29 06:01:59

On 3/29/21 10:55 AM, Bagas Sanjaya wrote:
Is date format parsing specific to git commit? If so, then
why not date-formats.txt be merged to `DATE FORMATS` section
of git-commit documentation?
It is already included below the `COMMIT INFORMATION` section.
Also, what commit this `--date`
option first appeared before you write this documentation?
I guess it was introduced in commit a8aca418d6484400d6804e22717bd49ca06c28e9.
quoted
+`tea`::
+    Change commit time to 17:00(tea time). If the current
+    time is less than 17:00, the time will be set to 17:00
+    on the previous day, else it will be set to 17:00 on
+    the same day.
How useful is this argument?
I think initially it was suggested as a joke, but actually implemented

to demonstrate the ability for users to include their own custom

time/date periods.

See : https://github.com/git/git/commit/a8aca418d6484400d6804e22717bd49ca06c28e9

Re: [PATCH v2] Documentation: updated documentation for git commit --date

From: Bagas Sanjaya <hidden>
Date: 2021-03-29 11:12:07

On 29/03/21 13.02, Chinmoy Chakraborty wrote:
I think initially it was suggested as a joke, but actually implemented

to demonstrate the ability for users to include their own custom

time/date periods.
Hmmm...

The commit you mentioned (a8aca418d6484400d6804e22717bd49ca06c28e9)
said that:
    Thanks for pointing out tea-time.

    This is also written to easily extended to allow people to add their own
    important dates like Christmas and their own birthdays.
But it seems like the predefined dates/times were hard-coded, so to extend
--date option to allow more predefined date/times, Git sources need to
be edited.

Maybe we can make git config option (commit.predefined_times [FIXME: suggest
better name]) so user can easily add ones.

Also, I asked to you: can I set --date to arbitrary date (like 09/29/2009
19:59)?

[CC] Junio, what about this patch?

-- 
An old man doll... just what I always wanted! - Clara

Re: [PATCH v2] Documentation: updated documentation for git commit --date

From: Chinmoy Chakraborty <hidden>
Date: 2021-03-29 14:56:15

On 3/29/21 4:41 PM, Bagas Sanjaya wrote:
Also, I asked to you: can I set --date to arbitrary date (like 09/29/2009
19:59)?

Sure you can use something like git commit --date='2009-09-29 19:59:00'

or git commit --date=`2 days ago`
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help