How do you find who or what pushed a specific commit to a protected branch?
AdvancedProductionRecovery and incident handling
Answer
Combine git log --format='%H %an %cn' with the audit log and the PR that merged it (gh pr list --search <sha> --state merged). Merge commits show the committer as GitHub for web merges. The audit log shows pushes, bypasses and force-pushes with actor and time.
gh pr list --search "<sha>" --state merged --json number,author,mergedBy
More on Recovery and incident handling
Someone force-pushed over main and 12 commits vanished. How do you recover?IntermediateAfter recovery, what do you change so a force-push to main cannot happen again?AdvancedA bad migration commit was deployed. Walk through your response in the first 15 minutes.IntermediateHow do you recover a deleted repository or branch on GitHub?IntermediateCI is red on main after a merge. What is your policy?IntermediateA teammate rebased a shared branch and now everyone has duplicate commits. How do you repair it?Advanced