Skip to content

Instantly share code, notes, and snippets.

@zeroem
Last active April 27, 2017 11:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeroem/6822534 to your computer and use it in GitHub Desktop.
Save zeroem/6822534 to your computer and use it in GitHub Desktop.
#!/bin/bash
COMMITS=$(git log --oneline | cut -d " " -f 1)
for COMMIT in $COMMITS
do
git checkout $COMMIT
./path/to/script.sh
if [ $? -eq 0 ]
then
echo $COMMIT passed
else
echo $COMMIT failed
fi
done
git checkout master
@zeroem
Copy link
Author

zeroem commented Oct 4, 2013

./path/to/script can be an absolute path or relative to the current working directory (pwd). $? holds the exit code of the last executed command. So assuming your script exits with a non-zero exit code on failure, the rest will just work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment