The commit history told the story. But it didn’t tell you who touched the code, what they changed, or when it happened in detail. When a repo goes wrong, you reach for git reset. The problem: reset changes your branch state, but it can obscure who accessed what and when. If you need a forensic trail, you have to dig deeper.
git reset is a powerful command that moves your current HEAD to a specific commit. It can be --soft, leaving files staged; --mixed, unstaging changes; or --hard, wiping out tracked file changes. Each type affects the visible history differently. When you reset, Git loses the commit references you just moved past—unless you’ve got reflog.
Reflog is your tracking ledger. git reflog logs all movements of HEAD, including resets, rebases, and merges. It lets you see who executed each action, complete with timestamps. Combined with git show and git log --author, you can map who made the commits, what they contained, and when they were authored versus accessed.
In shared repositories, server-side logs are critical. Git itself does not track “access” in the sense of file reads—it tracks changes. To connect “access” to “change,” you need audit logs from your Git hosting platform (GitHub, GitLab, Bitbucket). These logs tie user accounts to push, fetch, and merge events. Coordinating Git command history (via reflog) with platform logs gives you a clear chain of custody.
Steps to track who accessed what and when after a git reset:
- Run
git reflog to see all branch movements, even after resets. - Identify commit hashes and match them with
git show <hash> for authorship. - Check hosting service audit logs for access and push events.
- If necessary, restore lost commits using
git checkout <hash> or git cherry-pick.
This approach ensures a reset doesn’t erase the record you need. It lets you rollback code without losing sight of accountability.
Want this level of visibility baked in without wrangling multiple tools? See it live with hoop.dev—set up in minutes and get instant access trails, commit context, and reset-proof history.