Skip to content

Instantly share code, notes, and snippets.

@tonygaetani
Created March 2, 2016 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonygaetani/6e4868639db12fe1bf8c to your computer and use it in GitHub Desktop.
Save tonygaetani/6e4868639db12fe1bf8c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
HEAD=$(git rev-parse --abbrev-ref HEAD)
if [[ "${HEAD}" == "HEAD" ]]; then
HEAD=$(git rev-parse HEAD)
fi
STASH=0
if [[ -n $(git status --porcelain) ]]; then
git stash
STASH=1
fi
trap "git checkout ${HEAD} && test ${STASH} -ne 1 || git stash pop" EXIT
readonly COMMITS=$(git log --pretty=oneline "${START}...${END}"| cut -d' ' -f1| tail -r)
for commit in ${COMMITS[@]}; do
git checkout $commit
./gradlew build -x test > "build${commit}" 2>&1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment