What happens if you’re lazy (like me), and happen to only make that final commit way past your boss’s deadline? Well, you can manipulate the date!~ Before you commit your code, simply add the following lines:

export GIT_AUTHOR_DATE="YYYY-MM-DDThh:mm:ss±hh:mm"
export GIT_COMMITTER_DATE="YYYY-MM-DDThh:mm:ss±hh:mm"

Set Git date variables

Now you can commit as usual.

git add --all
git commit

Revert back to wall clock time

Now that you’re done with committing with your favourite mahurat (महुरत), you can come back to wall clock time by simply closing the Terminal window; or if you’re feeling a bit professional, by unsetting the environment variables.

unset GIT_AUTHOR_DATE
unset GIT_COMMITTER_DATE

Wait! I’ve already committed with the “wrong” date

Don’t fret. You can amend a commit right off the prompt:

# Amend only AUTHOR_DATE. Careful, hash changes after amendment.
git commit --amend --date="YYYY-MM-DDThh:mm:ss±hh:mm" -C 28f2d7b81e037aa4fcdf45f6353cb7c2aa10e336
# Amend both COMMITTER_DATE and AUTHOR_DATE.
GIT_COMMITTER_DATE="YYYY-MM-DDThh:mm:ss±hh:mm" git commit --amend --date="YYYY-MM-DDThh:mm:ss±hh:mm" -C HEAD~2

Amend date in the Terminal

Why two dates?

The author is the person who originally wrote the work, whereas the committer is the person who last applied the work. ―Pro Git book

You can read more about Git dates at Alex’s blog.

Thank you for scrolling to the bottom of this page! Do let me know how it was.