How GIT modifies author date and commiter date

you need to use the merge request method of gitlab. When you try new Merge Request, the gitlab page reports an error. After viewing the gitlab backend log, you can see
"Rugged::OdbError (Failed to parse commit aef3846d6401d68asdfsdf281c39cb584b812d-cannot parse commit time):
app/services/compare_service.rb:11:in `new"
app/services/compare_service.rb:11:in `execute"
app/controllers/projects/compare_controller.rb:13:in `show""

.

look at this commit, author_date and commiter_date are 2099 (yes, the project was open to modification, the developer changed the local date for self-test, and forgot to change it back when commit). All in all, there are some commit on this project that are after the current date, and it is estimated that this date has affected compare, now trying to change them back.

looked at a lot of materials and thought that git filter-branch should be able to solve this problem. I tried the following script:

git filter-branch -f --env-filter "
   if [ $GIT_COMMIT = aef3846d6401d68asdfsdf281c39cb584b812d ]
   then
       export GIT_AUTHOR_DATE="Mon Jun 25 14:13:00 CST 2018"
       export GIT_COMMITER_DATE="Mon Jun 25 14:13:00 CST 2018"
   fi"     

however, it didn"t work, and the script finished running normally, and the date didn"t change.
are there any brothers who have dealt with similar problems for advice!

Mar.25,2021

answer it yourself, and finally choose this method:

git rebase -i xxxxxx^

where xxxxxx is the wrong submitted commit_hash, and then in the pick editor that appears, change the pick in front of xxxxxx to edit;
so that when doing rebase, you will stop and interact with the specified commit, and execute the following command to edit commit:

GIT_COMMITTER_DATE='2018-07-12 00:00:00' GIT_AUTHOR_DATE='2018-07-12 00:00:00' git commit --amend --no-edit --date '2018-07-12 00:00:00'

modify the date of commit, then git rebase-- continue

after completing rebase git push-- force

it is simple to say, but in practice, because there are too many submission histories, thousands of them, including dozens of date errors, git rebase-I selects the earliest error commit, and then changes the commit that needs to be modified to edit, in the editor to interact. Because there may be merge conflicts, there may be the need for git add. For new files. Thousands of items require constant human-computer interaction.

has been messing around for a long time. I wrote a program with java, executed the shell command, and made different inputs according to the different output of the command.

Menu