This issue really threw me off and my searches didn't turn up any helpful info so I'm posting this to help any other poor soul who runs into this.
I was working on an Android repository today and made a number of commits and merges and all the regular stuff.
I noticed at one point that a commit listed under a ticket on our git server has a date of 8 days ago. The commit was not eight days old, I had created it from scratch and pushed it to the ticket less than 15 minutes before.
I thought, this is strange and wondered if the server time was wrong. Having confirmed it wasn't, I looked at the commits more closely. The dates all looked fine in SourceTree (a git gui I use). Knowing that a commit can have a separately set authoring date, I used git log --pretty=fuller
to view and compare the dates.
C:\Users\Jonathan\StudioProjects\BTVehicle>git log --pretty=fuller -n 2
commit 29ee84b938c016ff747d088c9c8d038f5ed99e72
Merge: f462490 7a76ac3
Author: Jonathan
AuthorDate: Wed May 25 16:19:18 2016 -0500
Commit: Jonathan
CommitDate: Wed May 25 16:19:18 2016 -0500
Merged #416 "CursorIndexOutOfBoundsException: Index 1 requested, with a size of 1"
commit 7a76ac3903380d7e1bde693947da84cab328cc7a
Author: Jonathan
AuthorDate: Tue May 17 12:55:07 2016 -0500
Commit: Jonathan
CommitDate: Wed May 25 16:19:14 2016 -0500
Added what could be a fix for the CursorIndexOutOfBoundsException as described in ticket #416.
The merge commit above was done on my server. The times are accurate. The other was done on my local machine (via Android Studio's source control integration) and has an incorrect authorship time.
How did this happen? How can I fix future dates? My findings are below.