🔀 The Attribution That Got Left Behind in the Squash
A Co-authored-by trailer only survives a merge as long as whatever process writes the final commit message actually carries it forward, and a squash merge collapses an entire branch’s worth of individual commits – each with its own trailers – into a single new commit whose message is generated fresh, typically from just the PR title and the first commit’s body, with every other commit’s Co-authored-by trailer silently left out unless someone manually re-adds it before confirming the squash.
🔎 The Problem
# Branch history before squashing - three commits, each crediting a # different pairing partner: commit A: "Add validation logic" Co-authored-by: Dev One <one@example.com> commit B: "Fix edge case in validation" Co-authored-by: Dev Two <two@example.com> commit C: "Add tests" Co-authored-by: Dev Three <three@example.com> # After a default squash merge, the single resulting commit # message is generated from the PR title/description - none of # the three Co-authored-by trailers above are included unless # someone notices and manually pastes them into the squash commit # message box before confirming the merge.
✅ Fix: Collect and Re-Add the Trailers Before Confirming the Squash
- Before confirming a squash merge, run git log –format=’%(trailers:key=Co-authored-by)’ main..branch-name (or scan the individual commits manually) to collect every Co-authored-by line across the branch, and paste the full combined set into the squash commit’s message box – most Git hosting UIs let you edit this message right before the merge completes.
- If a repository squash-merges routinely and loses attribution often enough to matter, consider a merge strategy that preserves individual commits (a regular merge or a rebase-and-merge) for branches with meaningful multi-author history, reserving squash merges for branches where commit-level attribution genuinely doesn’t matter.
- For history that’s already been squashed and lost its trailers, the attribution isn’t recoverable from the squashed commit itself – check the original branch’s reflog or an open PR’s commit view (which often still shows the pre-squash commits even after the squash completes) while that data is still available, rather than after it’s been garbage collected.
🚨 Why This Is Dangerous
- The squash merge completes without any warning that attribution data was dropped – Git has no concept of a Co-authored-by trailer being ‘required’ to carry forward, so there’s no error, no confirmation prompt, nothing distinguishing a clean squash from one that just quietly erased a pairing partner’s credit.
- This disproportionately affects contributors whose main record of having worked on something IS the Co-authored-by trailer – a junior developer or a pairing partner who didn’t open the PR themselves can lose their only visible attribution for real work, discovered (if ever) only by someone specifically checking contribution history later.
A squash merge doesn’t ask whether the trailers in the commits it’s collapsing still matter to someone – it just generates a new message from whatever the merge tool defaults to, and anything not explicitly carried forward is gone the moment the squash completes.

