Skip to content

Instantly share code, notes, and snippets.

@alexradzin
Created August 4, 2022 07:46
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 alexradzin/2b7dba05aa5e418796b9ec2f307e8f5f to your computer and use it in GitHub Desktop.
Save alexradzin/2b7dba05aa5e418796b9ec2f307e8f5f to your computer and use it in GitHub Desktop.
Script that iterates over git revisions from oldest to the newest in current branch
#!/bin/sh
pressAnyKey="Press any key to continue"
pressAnyKeySpaces=`echo $pressAnyKey | sed 's/./ /g'`
(git log --pretty="format:%H %s"; echo) | tac | while read line; do
hash=`echo $line | cut -d' ' -f1`;
message=`echo $line | cut -d' ' -f2-`;
git checkout -q $hash;
echo $message;
printf "$pressAnyKey\r"
read -s -n 1 <&1;
printf "$pressAnyKeySpaces\r"
git switch - -q;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment