Two engineers pair-programmed and you want both credited on the commit.
BeginnerScenarioRemotes, Collaboration and Pull Requests
Answer
Situation read → A commit has one author but can credit others with trailers.
What I'd do →
- Add a trailer at the end of the message, after a blank line:
Add retry to webhook sender
Co-authored-by: Priya Sharma <[email protected]>
- Use an email linked to their GitHub account so the avatar shows.
- On squash merges, GitHub keeps these trailers in the final commit message.
Why → GitHub parses Co-authored-by and credits both in the UI and contribution graph.
Interview tip → Verify the trailer survives when the squash message is edited.
More on Remotes, Collaboration and Pull Requests
You are new to a team. How do you collaborate daily without stepping on others' toes?BeginnerYou are migrating a repo from Bitbucket to GitHub and must keep every branch and tag.IntermediateYou want to contribute a fix to an open-source project you do not have write access to.BeginnerA teammate sent a 3,000-line PR and nobody can review it properly.IntermediateA reviewer asks for changes. How do you update the PR cleanly?BeginnerYour team wants stacked PRs so that large work arrives in small reviewable steps. How do you set it up?Advanced