Interview Prep/Git & GitHub/Remotes, Collaboration and Pull Requests

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 →

  1. 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]>
  1. Use an email linked to their GitHub account so the avatar shows.
  2. 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.

All Git & GitHub questions Roadmap: Git & GitHub

More on Remotes, Collaboration and Pull Requests