You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
Get commit author date, rather than committer date #1542
When I amend a commit, its date in the .date() method gets updated. Please give us an option to also retrieve the original, author date for a commit, too.
It seems like git log actually defaults to showing the author date too, rather than the committer date.
Thanks, that method worked. I can't find the method in the docs though.
And, I mean the original creation date of the commit. That's the "author date" I assume. While the "committer date" is basically the last time the commit was touched.
Pedantically speaking, "the last time the commit was touched" and "the original creation date of the commit" are the same, as a touched commit is an entirely new commit.
The idea carries semantic value though, and you are exactly correct in that author date is meant to provide that information. When a commit is rebased or otherwise recreated, the new commit takes the "source" commit's author info as its own. In the case of a new from scratch commit, that's the same as the commiter info, obviously.
Amend may be a bit different, since it's intent may be to make bigger changes, but I don't actually know. I'd assume it's the same way, since it's semantic intent is still to "change" a commit, rather than create a new commit, regardless of what actually happens under the covers
I'll make an issue in the docs repo that author info is seemingly missing.
Activity
rcjsuen commentedon Aug 29, 2018
@garyking To get the author's information or the committer's information, simply use
commit.author().when()orcommit.committer().when().As to your issue about amending, how would you get the original, pre-amended commit's date information from the CLI
git?garyking commentedon Aug 29, 2018
Thanks, that method worked. I can't find the method in the docs though.
And, I mean the original creation date of the commit. That's the "author date" I assume. While the "committer date" is basically the last time the commit was touched.
maxkorp commentedon Aug 29, 2018
Pedantically speaking, "the last time the commit was touched" and "the original creation date of the commit" are the same, as a touched commit is an entirely new commit.
The idea carries semantic value though, and you are exactly correct in that author date is meant to provide that information. When a commit is rebased or otherwise recreated, the new commit takes the "source" commit's author info as its own. In the case of a new from scratch commit, that's the same as the commiter info, obviously.
Amend may be a bit different, since it's intent may be to make bigger changes, but I don't actually know. I'd assume it's the same way, since it's semantic intent is still to "change" a commit, rather than create a new commit, regardless of what actually happens under the covers
I'll make an issue in the docs repo that author info is seemingly missing.