The wrong branch was live on the remote machines, and half the team was locked out of their own work.
When Git history collides with remote desktops, small mistakes can break an entire workflow. The good news: git reset gives you surgical control over your local and remote states, and with the right commands, you can recover fast without leaving debris.
First, know what you’re resetting. git reset changes your HEAD to a specific commit. On local repos, you can do:
git fetch origin
git reset --hard origin/main
This forces your branch to match the remote exactly. Any uncommitted changes disappear. If those changes live only locally, they’re gone for good. On remote desktops, this is even more important—you want consistent environments so every machine runs the same code.
If the remote already has the wrong commits and you need to rewrite history:
git reset --hard <commit-hash>
git push origin HEAD --force
This overwrites the remote branch. Anyone else with a stale copy will need to sync again. This step demands clear team communication because forced pushes can break other people’s work.