Setting Git Commit Dates


Here's a quick guide to manually set the date of a Git commit from the command line.

First up, you'll want to check the status to view any changed project files:

                            
                                git status
                            
                        

Next up, you'll want to add any file(s) to be commited (to your staged file list):

                            
                                git add path/to/name_of_file.html
                            
                        

Next, double check that your file(s) exist and made it onto your (staged) commit:

                            
                                git status
                            
                        

Lastly, you need to manually specify both the Author and Committer commit dates:

  • Formatted in ISO 8601 format
  • With "-05:00" Representing an East Coast Time Zone (for example)
                            
                                export GIT_AUTHOR_DATE="2022-01-01T11:11:11-05:00"
                            
                        
                            
                                export GIT_COMMITTER_DATE="2022-01-01T11:11:11-05:00"
                            
                        
                            
                                git commit -m 'add a commit message :)'
                            
                        
P U B L I S H E D
Monday, January 3, 2022

Send a Message

Please enter your name.
Please enter your email.
Please enter your message.