You’ve run git rebase a hundred times, but this time you’re hacking on a branch that depends on database state. Pgcli is open in another terminal, and you need to keep schema and data aligned as you rewrite commits. A careless rebase here could break your migrations, leave conflicts buried in SQL, or force you to dig through old dumps.
git rebase is powerful because it rewrites history. It lets you squash noisy commits, reorder changes, and keep the timeline linear. But when your branch includes database migrations for PostgreSQL, running Pgcli becomes essential. Pgcli gives you autocompletion, syntax highlighting, and quick inspection of your database objects. It’s the fastest way to verify the DB state after each step of a rebase.
The flow is simple:
- Start the rebase.
Run git rebase -i main (or your target branch). Choose edit for commits with significant DB changes. - Check migrations.
After Git pauses, run your migration scripts. Use Pgcli to check tables, indexes, and constraints. Confirm the DB is in the state the commit expects. - Fix as needed.
If tables fail to load or data mismatches occur, adjust the migration in your working tree. Use git add and git rebase --continue to move forward. - Repeat until the end.
With Pgcli, you catch broken SQL before it ships. By the time the rebase finishes, both code and DB history are clean.
Avoid skipping verification during a rebase—especially on branches with schema changes. A visually perfect Git history is worthless if half your migrations fail in production. Using Git Rebase and Pgcli together keeps both forms of history—code and database—in sync, traceable, and correct.
Want to see this workflow happen in minutes? Try it now at hoop.dev and run Git Rebase with Pgcli live.