Run a build on all commits in a git branch
Sometime, you need to check that all the commits in a branch are building correctly. For example, when a rebase has been done, it is possible you or diff has made a mistake during the operation. The building operation can be run against all commits of the current branch with the following one-liner (splitted here for more readability): for COMMIT in $(git log --reverse --format=format:%H origin/master..HEAD); do git checkout ${COMMIT} ; make -j8 1>/dev/null || { echo "Commit $COMMIT don't build"; break; } done The idea is trivial, we build the list of commits with git log using a simple format string (to get only the hash). We add the reverse tag to start from the oldest commit. For each commit, we checkout and run the build command. If the build fails, we exit from the loop. ...