Git run shell command for each commit

You can use interactive rebase with an exec option.

git rebase -i --exec <build command> <first sha you want to test>~

–exec Append “exec ” after each line creating a commit in the final history. will be interpreted as one or more shell
commands.

Reordering and editing commits usually creates untested intermediate
steps. You may want to check that your history editing did not break
anything by running a test, or at least recompiling at intermediate
points in history by using the “exec” command (shortcut “x”).

The interactive rebase will stop when a command fails (i.e. exits with
non-0 status) to give you an opportunity to fix the problem.

Leave a Comment

tech