Video summary

How to Change the Date of a GitHub Commit

Main summary

Key takeaways

Technology

Changing the Date and Time of a Git Commit in GitHub

This video tutorial by Max Diddley explains how to change the date and time of a Git commit in a GitHub repository. It provides a practical guide for developers who need to backdate or modify commit timestamps for accuracy or record-keeping.

Key Steps and Concepts

  • Initial Commit: Make a normal commit locally without pushing it to the remote repository.

  • Editing Commit Date: Use Git commands in a terminal (Command Prompt or Git Bash) to amend the commit date and time.

  • Environment Setup: If using GitHub Desktop, open the repository in a command prompt to run Git commands.

Git Commands Explained

  • Set both the author date (when the work was originally created) and the committer date (when the commit was saved) to the desired date/time.
  • The main command involves setting environment variables GIT_AUTHOR_DATE and GIT_COMMITTER_DATE followed by:

bash git commit --amend --no-edit

Handling Errors

If the initial command fails (for example, if you see an error like "git author date is not recognized"), use separate set commands for each date variable before amending the commit:

set GIT_AUTHOR_DATE="desired_date_time"
set GIT_COMMITTER_DATE="desired_date_time"
git commit --amend --no-edit

Pushing and Verification

  • After amending the commit date, push the commit to GitHub.
  • Verify the commit date has been updated as desired by checking the commit history on GitHub.

This tutorial is especially useful for developers who want to ensure their commit timestamps reflect the actual time of work or for maintaining accurate project records.

Rate this summary

Your feedback will help improve summaries.

Improve this summary

Reprocess with a stronger model when the summary feels incomplete or inaccurate.

Pro

Translate summary in another language

Pro

Ask questions to this video

Chat for follow-up questions, clarifications, and source-backed answers.

Coming soon

Share this summary

Original video