Answer the question
In order to leave comments, you need to log in
How to change the time when the commit was pushed to the repository, is it possible?
The repository has a commit that was pushed 2 hours ago at 8:00 (commited 2 hours ago). Can I somehow change this time, for example, to yesterday at 22:00, what would be displayed to me committed 12 hours ago?
Answer the question
In order to leave comments, you need to log in
Each commit stores two times: Author date and Commiter date.
doc on GitHub .
To see both times, you can set the git log command with the --format=fuller flag.
$ git log --format=fuller -1
commit f0eac...
Author: ... <...>
AuthorDate: Tue Nov 16 09:00:00 2021 +0300
Commit: ... <...>
CommitDate: Mon Nov 15 22:00:00 2021 +0300
...
--date
changes the Author date, which shows the git log, while GitHub shows the Committer date. To change it, you have to act a little more difficult. You need to define an environment variable GIT_COMMITTER_DATE
. For example, in bash it is done like this:GIT_COMMITTER_DATE=$(date -R -d 'yesterday 22:00') git commit --amend --no-edit --date='yesterday 22:00'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question