Set the date of the last commit to the current date
GIT_COMMITTER_DATE="$(date)" git commit --amend --no-edit --date "$(date)"
Set the date of the last commit to an arbitrary date
GIT_COMMITTER_DATE="Tue 16 Jul 2019 12:00:11 HKT" git commit --amend --no-edit --date "Tue 16 Jul 2019 12:00:11 HKT"
Set the date of an arbitrary commit to an arbitrary or current date
Rebase to before said commit and stop for amendment:
git rebase <commit-hash>^ -i
Replace pick with e (edit) on the line with that commit (the first one)
quit the editor (ESC followed by :wq in VIM)
Either:
GIT_COMMITTER_DATE="$(date)" git commit --amend --no-edit --date "$(date)"
GIT_COMMITTER_DATE="Tue 16 Jul 2019 12:00:11 HKT" git commit --amend --no-edit --date "Tue 16 Jul 2019 12:00:11 HKT"
ref: https://codewithhugo.com/change-the-date-of-a-git-commit/