Skip to content

Instantly share code, notes, and snippets.

@7rin0
Created May 12, 2017 01:02
Show Gist options
  • Save 7rin0/2a5153acafc30afd002498a2a1b8bc3c to your computer and use it in GitHub Desktop.
Save 7rin0/2a5153acafc30afd002498a2a1b8bc3c to your computer and use it in GitHub Desktop.
Machine time, operation, rewrite , log
#/bin/bash
# Go back in time and apply some tests to
# obtain enough data to check project evolutions (QA, Perf, etc)
# i in range of desired days i.e: 0-70
for i in {0..70}
do
# Change directory to targeted project
cd ~/some/project/using/git
# The date before
OLD_DATE=$(date -d "-$i week" +"%Y-%m-%d")
# The target commit to switch to
COMMIT=$(git log -1 --before=$(date -d "-$i week" +"%Y-%m-%d") | grep commit | tr -d 'commit ' | cut -c 1-6)
git checkout $COMMIT
# Apply some operation
run-script-against-project
# Reset changes,
git reset --hard
git branch
git checkout master
echo '======'$OLD_DATE'======'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment