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 Nov 18, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 18, 2021. It is now read-only.
Pull request "Squash and merge" button changes author details #1368
It was merged using the GitHub UI "Squash and merge" button (so that it would be rebased onto the current tip of origin/master) leading to the following commit on the main repository's master:
As expected, the Committer and CommitDate have been altered to reflect the person who pressed the merge button.
The AuthorDate has been altered by GitHub to be the same as CommitDate, but this is incorrect — the commit was still originally authored on Friday 14th.
The AuthorEmail has been altered by GitHub to be the default email address associated with the @jmarshall GitHub account at the time. This is very incorrect, as I do not use this email address when doing work on samtools/hts-specs.
When the "Squash and merge" button is being used to squash several commits from different authors, there is an argument to be had that Author/AuthorDate could be updated in some way (or GitHub could just follow what git does in this case).
When the "Squash and merge" button is being used to squash several commits from the same author (so AuthorName and AuthorEmail are the same, which is trivially true when there is only one commit), it is a bug to change the author's listed AuthorName or AuthorEmail.
Reacted by Adam Spiers, Peter Cock, Dobrosław Żybort, José Cage , Ian Malott, Simon Frei, Antonio C., Vigo Wei, MIYAMOTO Daisuke, justin and 30 more
Thanks for writing in about this! I'll pass your feedback along to the team. In the meantime, if you have the person who authored the PR itself squash and merge the PR, we retain more information about the author, so that might be a workaround for you in certain circumstances.
The workaround suggested is unworkable because the PR's author is not the maintainer of the code in question, so does not have the authority to review or merge the PR.
The real workaround is for the maintainer to do the merge using the git command line instead of GitHub's UI, but then we will likely run into #2.
commit eb9d6127c89b7fe8d08c13c4e877ba3ad33af4fe
Author: John Marshall <[email protected]>
AuthorDate: Tue Sep 4 11:42:42 2018 +0100
Commit: Mike Lin <[email protected]>
CommitDate: Sun Sep 16 14:23:18 2018 -0700
Here the original AuthorDate and AuthorEmail have been retained, as expected. So the arguably incorrect date behaviour and the clearly incorrect email behaviour are a recent change, deployed on GitHub.com somewhere between September 16th and 19th.
Reacted by Adam Spiers, José Cage and Tanzinul Islam
@aspiers: #1303 is a complaint (filed in July) that a particular project maintainer didn't appropriately preserve Author information when rebasing the OP's commits, and a request for a GitHub enhancement to preserve the original Authors informations outwith git when squashing commits from several authors in the UI.
This is a bug report about a behaviour change in September. The two pertain to related areas of functionality, but are not duplicates.
Upon further testing, I see that AuthorName is also affected.
Whatever you carefully set up your Name and Email address to be, e.g., via bespoke user.name and user.email config entries appropriate for the particular repository, if your PR is merged via the GitHub UI “Squash and merge” button then in the resulting commit the AuthorName and AuthorEmail will be rewritten behind your back to your GitHub account's profile name and primary email address.
Followup email sent to [email protected] today, attempting to highlight the personal information disclosure angle. You would think the discarding users' carefully-constructed author information angle would be bad enough to gain attention in itself… — Git has one job — to preserve historical information accurately…
Could you please comment on the status of this bug report. It is a serious issue as it leads to misattribution of commits when a person uses their GitHub account for both e.g. work-related and personal activities.
Suppose I have my GitHub account set up with a profile name of "John Marshall" and a primary email address of my work email address, say [email protected].
Suppose I contribute to some nethack-style game in the evenings, and set up my clone's repository config such that PRs are submitted with commits like
If the game maintainers merge this PR using the "squash & merge" button, the resulting commit on master will have its author information rewritten by GitHub to
This is wildly inappropriate and constitutes a doxxing of the user's work persona. (If several email addresses associated with the same GitHub account are on commits in different projects, to be sure it's not too hard to discover the other associated email addresses. However this bug reduces the effort required to zero and writes the work persona into the game repository's permanent commit history.)
Please comment as to whether GitHub accepts the seriousness of this issue, and what steps are being taken to fix it.
Reply received from GitHub Support on January 2nd:
Hey John,
My sincerest apologies for the delay in our response!
It looks like our Engineering Team are currently working on investigating the contribution attribution logic for Squash Merges. There isn't any concrete decisions taken place as yet but it does seem to be moving forward.
We appreciate your patience on this one and as soon as we have an update for you we'll be in touch.
Problem still exists unchanged on retesting today; my reply to Support, sent today:
Dear [Support],
Thank you for your reply. Could GitHub please comment on whether it considers this to be a serious and significant issue?
To my mind GitHub has been misidentifying these commits since September, and I would expect Engineering to want to revert September's logic change immediately (so as to stop adding more incorrectly-attributed commits to project histories) while they continue to work on further logic changes.
To clarify, my down-thumbs reaction 👎 on John's update today was about the lack of any movement from GitHub.
I often do squash-and-merge commits of pull requests, but thus far haven't had anyone complain - people setting their commit authorship differently to their Github profile must be a minority? However, they would be a tech savvy minority ...
The Issue has been marked as Priority 1 and is currently being investigated by our Engineering Team.
Thanks (assuming 1 = high!). Insert here standard concern about “no response” and “bug report disappeared into the void” being indistinguishable…
GitHub has supported attaching multiple email addresses to each GH account for many years. This author rewriting goes directly against this, so once again it seems astonishing that the September behaviour was ever deployed…
@jmarshall What's your take on the latest change? Is it fair to say that it resolves some aspects of this issue but not all? For example at a glance it doesn't seem to address date changes, but I haven't tried it myself. As @clarkbw suggested, maybe it makes sense to split them into separate issues.
@WilliamMartinsson: Nope. As previously noted, the choose-your-email dropdown added to the PR merge dialog is (the latter part of) #95. This issue is about what happens to Author and AuthorDate in the resulting commit merged to the main branch. If you did it on the command line, they would be unchanged (while Committer and CommitDate would be updated to reflect the person who altered the commits by rebasing) and this is what the GitHub UI appears to have done up until last September (see #1368 (comment)). So you would have to show us git log --format=fuller for the PR commit(s) and the merged commit to judge whether the behaviour is as per this issue.
So just now I have tested this once again, this time (for the first time) testing it as if I have composed a pull request containing another GitHub user's work:
commit e7888595c3173508bc808857ecc0c236eb491952
Author: On behalf of A. Colleague <[email protected]>
AuthorDate: Thu May 9 21:24:21 2019 +0100
Commit: J. Marshall, esq <[email protected]>
CommitDate: Thu May 9 21:24:21 2019 +0100
(The real [email protected] email address is the primary email address of another extant GitHub user.) This models a scenario in which I have rebased or otherwise amended my colleague's work and then (myself) created a PR out of the work. I then Squash'n'Merged the PR, selecting a different non-primary email address from the dropdown, resulting in the following commit on master:
commit 237523a06a17b0dac4f2a2a2f9192889e608188e
Author: John Marshall <[email protected]>
AuthorDate: Thu May 9 21:26:22 2019 +0100
Commit: GitHub <[email protected]>
CommitDate: Thu May 9 21:26:22 2019 +0100
As you see, AuthorDate has been updated to be the same as CommitDate, which is different from what the Git command line would do and IMHO wrong.
As you see, the <…email-two@…> email address that I selected from the dropdown has been used and my name has been updated from J. Marshall, esq to my GitHub account's profile name. If I do committer actions from the GitHub UI, I would expect GitHub to use the form of my name that it knows to record the committer identity — so that #95 stuff is working appropriately IMHO.
As you also see, my committer identity has been shoved into Author, and my colleague's authorship has been removed entirely. This is absolutely astonishing and is an even worse behaviour than that in my original report back in September.
Unfortunately I haven't tested this with another GitHub user's email address previously, so I don't know whether this behaviour is new. @zephraph's second PR in #1368 (comment) suggests that this behaviour is indeed new since April 17th, as in that case renovate-bot's authorship was retained in the commit as merged. (But it is hard to be sure, as in that case renovate-bot opened the PR that contained renovate-bot's commit, but in my test just now it was I who opened the PR containing my colleague's commit. It is conceivable that GitHub might be overriding Author with PR-opener rather than PR-merger. Either way it is IMHO the wrong thing to do, of course.)
In summary, there does appear to have been a recent change in behaviour and it appears to have made the authorship aspects of this issue much worse. It would be interesting to hear what GitHub's goals in altering Author at all are.
What I would expect to happen in this case is the same thing as happens with git rebase -i on the command line: Author and AuthorDate are untouched, and Commit/CommitDate reflect the changes to the commit in rebasing and squashing it/them:
commit 191d10423d12d33eadc36189d350183076b12cf1
Author: On behalf of A. Colleague <[email protected]>
AuthorDate: Thu May 9 21:24:21 2019 +0100
Commit: John Marshall <[email protected]>
CommitDate: Thu May 9 22:02:44 2019 +0100
Reacted by William Madsen Martinsson, Adam Spiers, Claire Foster, Ricky Wong, Tanzinul Islam and Peter Cock
@jmarshall I really appreciate the in-depth breakdown here. Thanks for taking the time to share that. I've been researching the history of the behavior internally to try to determine the expected behavior (and why it is that way). I'm still waiting to hear back from a few colleagues, but I did want to share my understanding so far:
When the PR author is the actor, we use [email protected] as the committer, and the actor as the author for the merge commit, which allows us to create a signed commit (since we have [email protected]'s key).
When the PR author is not the actor, we want to capture both the author of the PR and the user who merged the pull request, so we set the author as the PR author and the committer as the actor for the merge commit.
@jmarshall: Thank you for your extensive explaining, it was a great read!
I have to admit that I probably was so exited seeing progress on the issue described in #95 (which you kindly pointed out) and naively thought this feature would apply to this issue as well.
Any news on this issue? It's quite an issue that PR authors aren't kept in the final merge/squash commit message. As maintainer, and hence reviewer and merger, I do NOT want to get credits for work done by others.
Reacted by Peter Cock, Richard LT, Zsolt Borbély, Sander Kranz, Ismael Juma, David Arthur, HARSHIT GUPTA, Bob Fahr, Tamas Nagy, radekk and 20 more
When the PR author is not the actor, we want to capture both the author of the PR and the user who merged the pull request, so we set the author as the PR author and the committer as the actor for the merge commit.
For squash-and-merged PRs git log shows: Commit: GitHub <[email protected]> even if the PR author is not the actor who initiated the merge. It appears that GitHub stores who has merged the PR only in the GitHub PR metadata, but does not store it within git metadata. @benbalter could you please clarify the reason for this behavior? Thank you.
I think gitlab here makes a great example. It squashes all the commits and then makes a merge of that unique commit. Allowing to view who was the contributor of the branch and the author who did the Pull Request.
Activity
jmarshall commentedon Sep 21, 2018
Reply from
[email protected]:The workaround suggested is unworkable because the PR's author is not the maintainer of the code in question, so does not have the authority to review or merge the PR.
The real workaround is for the maintainer to do the merge using the
gitcommand line instead of GitHub's UI, but then we will likely run into #2.jmarshall commentedon Oct 5, 2018
samtools/hts-specs#335 is a PR that was merged via the GitHub UI (likely also with the "Squash and merge" button), resulting in the commit samtools/hts-specs@eb9d612 on master:
Here the original AuthorDate and AuthorEmail have been retained, as expected. So the arguably incorrect date behaviour and the clearly incorrect email behaviour are a recent change, deployed on GitHub.com somewhere between September 16th and 19th.
aspiers commentedon Oct 5, 2018
This seems to be a rough duplicate of #1303, although it does helpfully provide a lot more details.
jmarshall commentedon Oct 5, 2018
@aspiers: #1303 is a complaint (filed in July) that a particular project maintainer didn't appropriately preserve Author information when rebasing the OP's commits, and a request for a GitHub enhancement to preserve the original Authors informations outwith git when squashing commits from several authors in the UI.
This is a bug report about a behaviour change in September. The two pertain to related areas of functionality, but are not duplicates.
jmarshall commentedon Oct 7, 2018
Upon further testing, I see that AuthorName is also affected.
Whatever you carefully set up your Name and Email address to be, e.g., via bespoke
user.nameanduser.emailconfig entries appropriate for the particular repository, if your PR is merged via the GitHub UI “Squash and merge” button then in the resulting commit the AuthorName and AuthorEmail will be rewritten behind your back to your GitHub account's profile name and primary email address.Stanzilla commentedon Nov 2, 2018
Just noticed this as well, see this commit https://github.com/WeakAuras/WeakAuras2/commit/fa75abcc7b618b93d416aaa3f0a6315a2ab486d8.patch that was a
Squash & Mergeand it usedInfusOnWoWas username, while this https://github.com/WeakAuras/WeakAuras2/commit/52de0a0de49afd9f665638227d2a003dd7267750.patch was aRebase & Mergeand it usesInfusas name.jmarshall commentedon Dec 5, 2018
Problem still exists: see PR jmarshall/test@02f15df which became jmarshall/test@2105ce7 on Squash'n'Merging. (Add .patch to those links to see a rawer view of the commits.)
jmarshall commentedon Dec 14, 2018
Previously tweeted about here and here.
Followup email sent to
[email protected]today, attempting to highlight the personal information disclosure angle. You would think the discarding users' carefully-constructed author information angle would be bad enough to gain attention in itself… — Git has one job — to preserve historical information accurately…jmarshall commentedon Jan 7, 2019
Reply received from GitHub Support on January 2nd:
Problem still exists unchanged on retesting today; my reply to Support, sent today:
peterjc commentedon Jan 7, 2019
To clarify, my down-thumbs reaction 👎 on John's update today was about the lack of any movement from GitHub.
I often do squash-and-merge commits of pull requests, but thus far haven't had anyone complain - people setting their commit authorship differently to their Github profile must be a minority? However, they would be a tech savvy minority ...
jmarshall commentedon Jan 14, 2019
Reply received from Support today:
Thanks (assuming 1 = high!). Insert here standard concern about “no response” and “bug report disappeared into the void” being indistinguishable…
GitHub has supported attaching multiple email addresses to each GH account for many years. This author rewriting goes directly against this, so once again it seems astonishing that the September behaviour was ever deployed…
negebauer commentedon Mar 13, 2019
When editing a file from Github's UI you can actually select which email to use
But when merging a PR you can't, it should be an option too!
(Kinda related to this issue)
6 remaining items
clarkbw commentedon Apr 17, 2019
To clarify this a bit, we have updates coming related to the authoring part but nothing yet for what is happening with the dates.
just-be-dev commentedon Apr 17, 2019
So was the
on-behalf-ofmoderately useful?Sent with GitHawk
WilliamMartinsson commentedon May 9, 2019
This issue seems to have been resolved. When I was about to merge a PR I got presented with the following dropdown:

The
git loglooks good as well :)aspiers commentedon May 9, 2019
@jmarshall What's your take on the latest change? Is it fair to say that it resolves some aspects of this issue but not all? For example at a glance it doesn't seem to address date changes, but I haven't tried it myself. As @clarkbw suggested, maybe it makes sense to split them into separate issues.
jmarshall commentedon May 9, 2019
@WilliamMartinsson: Nope. As previously noted, the choose-your-email dropdown added to the PR merge dialog is (the latter part of) #95. This issue is about what happens to
AuthorandAuthorDatein the resulting commit merged to the main branch. If you did it on the command line, they would be unchanged (whileCommitterandCommitDatewould be updated to reflect the person who altered the commits by rebasing) and this is what the GitHub UI appears to have done up until last September (see #1368 (comment)). So you would have to show usgit log --format=fullerfor the PR commit(s) and the merged commit to judge whether the behaviour is as per this issue.So just now I have tested this once again, this time (for the first time) testing it as if I have composed a pull request containing another GitHub user's work:
PR jmarshall/test#22 contains one commit:
(The real
[email protected]email address is the primary email address of another extant GitHub user.) This models a scenario in which I have rebased or otherwise amended my colleague's work and then (myself) created a PR out of the work. I then Squash'n'Merged the PR, selecting a different non-primary email address from the dropdown, resulting in the following commit on master:As you see,
AuthorDatehas been updated to be the same asCommitDate, which is different from what the Git command line would do and IMHO wrong.As you see, the
<…email-two@…>email address that I selected from the dropdown has been used and my name has been updated from J. Marshall, esq to my GitHub account's profile name. If I do committer actions from the GitHub UI, I would expect GitHub to use the form of my name that it knows to record the committer identity — so that #95 stuff is working appropriately IMHO.As you also see, my committer identity has been shoved into
Author, and my colleague's authorship has been removed entirely. This is absolutely astonishing and is an even worse behaviour than that in my original report back in September.Unfortunately I haven't tested this with another GitHub user's email address previously, so I don't know whether this behaviour is new. @zephraph's second PR in #1368 (comment) suggests that this behaviour is indeed new since April 17th, as in that case renovate-bot's authorship was retained in the commit as merged. (But it is hard to be sure, as in that case renovate-bot opened the PR that contained renovate-bot's commit, but in my test just now it was I who opened the PR containing my colleague's commit. It is conceivable that GitHub might be overriding
AuthorwithPR-openerrather thanPR-merger. Either way it is IMHO the wrong thing to do, of course.)In summary, there does appear to have been a recent change in behaviour and it appears to have made the authorship aspects of this issue much worse. It would be interesting to hear what GitHub's goals in altering
Authorat all are.What I would expect to happen in this case is the same thing as happens with
git rebase -ion the command line:AuthorandAuthorDateare untouched, andCommit/CommitDatereflect the changes to the commit in rebasing and squashing it/them:benbalter commentedon May 9, 2019
@jmarshall I really appreciate the in-depth breakdown here. Thanks for taking the time to share that. I've been researching the history of the behavior internally to try to determine the expected behavior (and why it is that way). I'm still waiting to hear back from a few colleagues, but I did want to share my understanding so far:
[email protected]as the committer, and the actor as the author for the merge commit, which allows us to create a signed commit (since we have[email protected]'s key).WilliamMartinsson commentedon May 9, 2019
@jmarshall: Thank you for your extensive explaining, it was a great read!
I have to admit that I probably was so exited seeing progress on the issue described in #95 (which you kindly pointed out) and naively thought this feature would apply to this issue as well.
ericzolf commentedon Mar 5, 2020
Any news on this issue? It's quite an issue that PR authors aren't kept in the final merge/squash commit message. As maintainer, and hence reviewer and merger, I do NOT want to get credits for work done by others.
harshitsaamu commentedon Mar 5, 2020
the same issue is being discussed here #1303
mavenraven commentedon Sep 9, 2020
Just got bit by this, the behavior was very unexpected!
keldin-coding commentedon Oct 3, 2020
Indeed! Just did my first maintainer merge and accidentally exposed a user's email who did not want that email in the git log.
package-lock.json: remove obsolete fluent-syntax (#1818)
tvalentyn commentedon Apr 22, 2021
For squash-and-merged PRs
git logshows:Commit: GitHub <[email protected]>even if the PR author is not the actor who initiated the merge. It appears that GitHub stores who has merged the PR only in the GitHub PR metadata, but does not store it within git metadata. @benbalter could you please clarify the reason for this behavior? Thank you.shehan-jay commentedon Jun 3, 2021
Is the number of lines added as co-author added here?

byjokese commentedon Jul 14, 2021
I think gitlab here makes a great example. It squashes all the commits and then makes a merge of that unique commit. Allowing to view who was the contributor of the branch and the author who did the Pull Request.
