Created
October 6, 2012 22:16
-
-
Save jorgenschaefer/3846361 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh | |
# check.sh origin | |
# | |
# This will fetch commits from origin, and then display the log of | |
# changes from origin back to when it first deviated from the current | |
# branch. | |
if [ -z "$1" ] | |
then | |
echo "usage: check <remote> [remotebranch]" | |
echo | |
echo "Possible values for remote:" | |
echo | |
git remote | sed 's/^/ /' | |
exit 1 | |
fi | |
REMOTE="$1" | |
if [ -z "$2" ] | |
then | |
REMOTEBRANCH="master" | |
else | |
REMOTEBRANCH="$2" | |
fi | |
git fetch "$REMOTE" | |
CURRENT=$(git rev-parse HEAD) | |
BASE=$(git merge-base "$REMOTE/$REMOTEBRANCH" HEAD) | |
if [ "$CURRENT" = "$BASE" ] | |
then | |
echo "No new changes on $REMOTE/$REMOTEBRANCH" | |
else | |
git log $BASE..$REMOTE/$REMOTEBRANCH | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment