Skip to content

Instantly share code, notes, and snippets.

@jobertabma
Last active March 13, 2018 23:26
Show Gist options
  • Save jobertabma/c003ec76dba958489d8d5cf5c741b12f to your computer and use it in GitHub Desktop.
Save jobertabma/c003ec76dba958489d8d5cf5c741b12f to your computer and use it in GitHub Desktop.
A script to manually iterate over git commits. Use qj/qk to navigate.
DIFF_NUMBER=1
while read -n1 -r -p "$DIFF_NUMBER:" && [[ $REPLY != q ]]; do
case $REPLY in
j)
DIFF_NUMBER=`expr $DIFF_NUMBER + 1`
;;
k)
DIFF_NUMBER=`expr $DIFF_NUMBER - 1`
;;
*)
esac
git diff HEAD~$DIFF_NUMBER..HEAD~`expr $DIFF_NUMBER - 1`
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment