Git reset in SQL*Plus is not a single command. It’s a method: restoring a database state from version control. The goal is simple—align the Oracle schema with a known commit in your Git repository, and discard the wrong changes.
Start with a clean Git workspace. Use git log to identify the commit that represents the correct schema and scripts. Once found, run:
git reset --hard <commit-hash>
This resets your local files to match that commit. Any DDL or DML script stored in this state can now be applied directly to your Oracle database via SQL*Plus.
Open SQL*Plus:
sqlplus user/password@dbname
Run the scripts in the correct order. First schema definitions, then seed data, then procedures. If a rollback script exists, execute it before reapplying the saved state. This ensures the database matches the Git reset precisely.
For work involving production data, never run Git reset and apply blindly. Test on a staging database with SQL*Plus connected to a non-critical instance. Confirm constraints, triggers, and indexes are intact.
Track changes by committing every migration or script before execution. This keeps Git reset in sync with SQL*Plus operations. Storing SQL files alongside application code ensures that reverting is predictable and safe.
Git reset with SQL*Plus isn’t just recovery—it’s control. It puts time back in your hands and locks errors out.
See how hoop.dev can streamline Git-driven database workflows—connect, reset, and deploy in minutes.