Reputation: 271
I need to push some code upstream into my repo. However I would like to see if It is possible to set the date of the commit/push to be something other than the current the date.This would mean if someone visited my github page and my desired date for the push was 00/00/00 it would show as 00/00/00 and NOT the current date.Is there anyway to do this?
Upvotes: 24
Views: 17947
Reputation: 1183
You can use the environment variable GIT_COMMITTER_DATE
to update commit date as well.
export GIT_COMMITTER_DATE='Wed Dec 21 11:51:39 IST 2022'
git commit --amend --no-edit --date='Wed Dec 21 11:51:39 IST 2022'
unset GIT_COMMITTER_DATE
To see if your change has taken effect,
git log --pretty=fuller
(of course, you will need to do a force-push, if you have already pushed the commit to upstream)
Upvotes: 17
Reputation: 6705
You can change the date of last commit:
git commit --amend --no-edit --date=now
or input date:
git commit --amend --no-edit --date="2020.11.02 12:00"
Upvotes: 42