Github squash and merge - how is the author email determined?

Hi there,

I’ve been looking through the documentaiton and this forum but I can’t find a concrete answer to this. I know that, when a pull request is merged using “squash and merge”, github uses the author of the pull request as the author of the resulting commit (and it uses if the author’s account is configured to keep e-mail private).

However: what is not quite clear to me is how it determines which e-mail address to use if not private (assuming the account has more than one e-mail address). Does it always use the primary e-mail address configured on the author’s account? Or does it look at e-mail notiifcation configuration for a particular repo? Or does it do something else? I have tried to do a few test merges on a private repo but have a hard time figuring out the exact logic.

Somewhat related: am I correct in assuming it sets both author id and committer id to the PR author?

In this case, it would be the primary email of the user that created the pull request.

In general, the commit is attributed to the primary email, unless a private email address is activated. As it is used for web-based commits.

1 Like

Thank you, that’s helpful to know.

Are you aware of any way to see in advance what author details will be used for a squash-and-merge operation on a particular pull request?

I’m involved in an open-source project where we try to link the author id to a contributor agreement on file, so having commits where the author id is anonimized or changed to a different addresss is problematic. We’d like to use squash-and-merge, but the possible unexpected author id is a risk for us.