Resetting the author date on a commit in git

I found a nice little one liner today to change the author date on a commit message. Why would you do this you ask? It’s brilliant after you’ve change history on your branch with a rebase and a squash.

All you need to do is use

git commit --amend --date=[date]

You can be even smarter though and use the current time from bash with

git commit --amend --date="$(date -R)"

Leave a Reply

Your email address will not be published. Required fields are marked *