When Git holds the truth and your DB drifts, you need a method to pull it back fast. git reset is a blunt tool for code. But for database roles—especially granular database roles—you need precision. A misapplied reset and you lose critical permissions or introduce a security gap.
Granular database role management serves one purpose: minimum privilege, maximum control. In real workflows, roles drift because developers commit changes to migrations or seed scripts that alter permissions unintentionally. Rolling back code does not always revert database state. That’s why combining git reset with a verified, granular role restoration process matters.
The correct workflow starts with version-controlling role definitions. Store them in a dedicated config or migration file. Tag releases that have known-good role setups. When an error ships, git reset --hard <commit> restores the file-level truth. Then, reapply those definitions to the database using your migration or schema tool so the DB state matches the commit state exactly.