How to run tests for all commits during a rebase
git, rebase
Solution
While you are on branch `feature` execute:
git rebase --interactive --exec "ant rebuild test" C
This will cause git to start again on commit C, replay your work on top and it will run your tests after each commit it applies during replay phase.
Hopefully your ant task will have a non-zero exit code if your tests fail. In this case git will stop as soon as the tests fail. You are immediately in the right position to amend you commit so that the tests will be happy again. After you have amended just execute `git rebase --continue` as usual and git will continue to check all you commits.
Problem
I have a feature branch with plenty of commits. ``` A---B---C master \ \-B'---C'---D'...---Z' feature ``` I am working on `feature` but another developer has created commits `B` and `C`. Now I want to rebase `feature` on commit `C`, but I and/or automerge introduced errors during the rebase. My project has very good test coverage and I can run the tests from console using `ant rebuild test`, and now I want git to tell me which commit is the first commit that breaks my test so I can fix that commit. How can I do that?