VEvergarden
VEvergarden

Reputation: 113

Change date of commits on github

I want to change date of 4 commits that I pushed to github today, say pushing them back by 3 dates.

I have 2 problems, and it seems that they are relevant:

  1. I use git rebase to fix the date of commits, but when I pushed them to github, the final commit will be labled today. enter image description here
  1. The public github page will still show the change I made as today.

Is there anyway I can fix this?

Upvotes: 1

Views: 1352

Answers (1)

VonC
VonC

Reputation: 1328522

You should use a git rebase -i --committer-date-is-author-date --ignore-date (with Git 2.29+, Q4 2020) when changing your date.

If not, the committer date would be today (IE, by default, the date when the rebase was done).

Or you can also use git filter-repo, as in this example, except the code would need (as in this gist)

commit.author_date = commit.committer_date = new_date.encode('utf-8')

Meaning filter-repo needs, in its callback, to change the author and committer date.

Upvotes: 2

Related Questions