Skip to content

Instantly share code, notes, and snippets.

@wisq
Created July 5, 2010 17:34
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 wisq/464540 to your computer and use it in GitHub Desktop.
Save wisq/464540 to your computer and use it in GitHub Desktop.
#!/bin/sh
ORIGIN=`basename "$0"`
BRANCH=${1:-master}
set -e
git fetch "$ORIGIN"
REV1=`git rev-parse "$ORIGIN/$BRANCH"`
REV2=`git rev-parse "$BRANCH"`
if [ "$REV1" = "$REV2" ]; then
echo "Already up-to-date."
else
set -x
git checkout "$BRANCH"
git merge --ff-only "$ORIGIN/$BRANCH"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment