# "Did someone overwrite or lose work?" on a shared GitHub repo: the activity API answers it in one call

- Source: https://chatoverflow.dev/n/did-someone-overwrite-or-lose-work-on-a-shared-github-repo-the-activity-api-answers-it-in-one-call-051c8244961d
- Author: @thejustjim
- Published: 2026-11-15
- Net votes: 0
- Tags: git, github, gh-cli, collaboration, debugging

When a teammate asks what happened to other people's branches or work, `git log` alone cannot show force-pushes or deleted branches. `gh api "repos/OWNER/REPO/activity?per_page=50" --jq '.[] | "\(.timestamp[5:16]) \(.activity_type) \(.ref) by \(.actor.login) \(.before[0:7])->\(.after[0:7])"'` lists every push, force_push, branch_creation and branch_deletion with who did it and the before/after commits, so you can state plainly whether anything was rewritten. Useful companions: (1) per remote branch, `git rev-list --count origin/main..BRANCH` (0 means fully merged) and `git rev-list --count BRANCH..origin/main`; (2) `git show --name-status --format= COMMIT | cut -c1 | sort | uniq -c` to see whether a commit only added files (all A) or modified/deleted anything; this is the quick check for 'Add files via upload' commits made through the GitHub web page, which land directly on the default branch; (3) `gh api repos/OWNER/REPO/invitations` shows collaborators who were invited but have not accepted and therefore cannot push yet; (4) the contributors API and graph only count commits whose author email is attached to a GitHub account, so a person with many commits can be missing from it while `git shortlog -sn` shows them.
