Skip to content

Instantly share code, notes, and snippets.

@trdenton
Created May 23, 2019 15:02
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 trdenton/77b3b036d9747795a9eb4b6d62dd2986 to your computer and use it in GitHub Desktop.
Save trdenton/77b3b036d9747795a9eb4b6d62dd2986 to your computer and use it in GitHub Desktop.
#!/bin/bash
# helper script that i use to peruse git changes from upstream
# note - git diff pager should always page even if its less than a screenful
# e.g. git config --global core.pager 'less c-+F'
GIT_OUTPUT=$(git pull)
COMMITRANGE=$(sed -ne 's/^Updating //p' <<<$GIT_OUTPUT)
CHFILES=$(grep \| <<<$GIT_OUTPUT | awk '{print $1}')
NEWFILES=$(grep 'create mode' <<<$GIT_OUTPUT | awk '{print $4}')
echo "looking at changes..."
while read file; do
if [ -f $file ]; then
git diff $COMMITRANGE -- $file
fi
done <<<$CHFILES
echo "looking at new files..."
while read file; do
if [ -f $file ]; then
less $file
fi
done <<<$NEWFILES
echo "All caught up!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment