When working on a branch and your are rewriting your history often it’s easy to come to a state when a commit doesn’t compile. It’s not obvious because your latest commit does compile. But it’s good hygiene for your application to compile at every commit. Fortunately an interative rebase can help you with this:

For example: git rebase -i master --exec "clear && yarn build" will run the command specified for each commit since master. In this example I have script in my package.json which builds the application. If the build fails git rebase will stop and ask me to fix the error and do a git rebase --continue.