The main branch was clean yesterday. Today, a merge wiped out critical code, broke a deployment, and triggered a wave of Slack pings. Rolling back wasn’t enough. The history had to be rewritten. This is when git reset becomes more than a command — it’s a way to take full control of the repository again.
But when you work in a commercial environment, especially in teams with multiple remote contributors and sensitive integrations, git reset is not just about code. Resetting changes means thinking about the impact across partners, continuous delivery pipelines, and compliance. A git reset in a private project is easy. A git reset with commercial partners watching every commit requires precision.
Reset comes in three main forms:
- Soft reset: Moves HEAD, keeps changes in the index, and lets you recommit.
- Mixed reset: Moves HEAD, clears the index, but leaves changed files in the working directory.
- Hard reset: Moves HEAD and wipes both index and working tree. All changes vanish unless backed up.
When code is shared with a commercial partner, the “hard reset” is rarely safe. Partners may have already synced to the commit you want gone. You risk breaking their builds or workflows. The best choice often blends git reset locally with careful communication and coordinated updates in the remote repository.