Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get commit author date, rather than committer date #1542

Closed
garyking opened this issue Aug 28, 2018 · 3 comments
Closed

Get commit author date, rather than committer date #1542

garyking opened this issue Aug 28, 2018 · 3 comments

Comments

@garyking
Copy link

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.

@rcjsuen
Copy link
Member

rcjsuen commented Aug 29, 2018

@garyking To get the author's information or the committer's information, simply use commit.author().when() or commit.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
Copy link
Author

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
Copy link
Collaborator

maxkorp commented 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants