Created
July 30, 2021 20:59
-
-
Save tverlaan/714c33609cc68dc1a33abb8f2d2a6a4d to your computer and use it in GitHub Desktop.
Basic script to review commits you just fetched one by one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
CURRENT_VERSION="${1:-HEAD}" | |
NEXT_VERSION="${2:-FETCH_HEAD}" | |
echo "Showing commits from $NEXT_VERSION since $CURRENT_VERSION" | |
COMMIT_COUNT=$(git --no-pager log --format=format:%H $CURRENT_VERSION..$NEXT_VERSION | wc -l) | |
echo "Commits to review: $COMMIT_COUNT" | |
echo | |
echo "$CURRENT_VERSION:" | |
git --no-pager log -1 $CURRENT_VERSION | |
echo | |
echo "$NEXT_VERSION:" | |
git --no-pager log -1 $NEXT_VERSION | |
echo | |
echo "To exit the pager hit Ctrl-C and then press q" | |
read -p "Continue? [y/n] " -n 1 -r | |
if [[ ! $REPLY =~ ^[y]$ ]] | |
then | |
echo | |
exit 1 | |
fi | |
git --no-pager log --reverse --format=format:%H $CURRENT_VERSION..$NEXT_VERSION | \ | |
while read commit; | |
do | |
git show -p $commit | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment